Team Ai
Apppublic

sam0303/Zero_Shot_Classification

sourceHugging Faceafl-3.0updated 4y agoView on Hugging Face
2likes
app.py20 linesDownload Raw Back to root
1pip install transformers2pip install gradio3from transformers import pipeline4import gradio as gr5classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")6 7def zshot (text, labels):8  result = ([text, classifier(text, labels)['labels'][0]])9  return(result)10 11app = gr.Interface(12    zshot,13    inputs=[14        gr.Textbox(label="Text", value=""),15        gr.Textbox(label="Label", value="['Food,Travel,Movie']"),16    ],17    outputs=["text"],18)19app.launch()20