inital
This commit is contained in:
commit
f29aa95b1d
|
@ -0,0 +1,28 @@
|
|||
import gradio as gr
|
||||
from transformers import pipeline
|
||||
|
||||
def inference(sequence_to_classify):
|
||||
model_path="mDeBERTa-v3-base-mnli-xnli"
|
||||
classifier = pipeline("zero-shot-classification", model=model_path)
|
||||
|
||||
candidate_labels = ["politics", "economy", "entertainment", "environment"]
|
||||
output = classifier(sequence_to_classify, candidate_labels, multi_label=False)
|
||||
return output
|
||||
|
||||
|
||||
examples=[["Angela Merkel ist eine Politikerin in Deutschland und Vorsitzende der CDU"]]
|
||||
|
||||
with gr.Blocks() as demo:
|
||||
gr.Markdown(
|
||||
"""
|
||||
# Text classification:mDeBERTa-v3-base-mnli-xnli
|
||||
Gradio Demo for mDeBERTa-v3-base-mnli-xnli. To use it, simply type in text, or click one of the examples to load them.
|
||||
""")
|
||||
with gr.Row():
|
||||
text_input = gr.Textbox()
|
||||
text_output = gr.Textbox()
|
||||
image_button = gr.Button("上传")
|
||||
image_button.click(inference, inputs=text_input, outputs=text_output)
|
||||
gr.Examples(examples,inputs=text_input)
|
||||
|
||||
demo.launch()
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9086d78af18a62546cf05a768934d291684d6309
|
Loading…
Reference in New Issue