Spaces:
Runtime error
Runtime error
| pip install transformers | |
| pip install gradio | |
| from transformers import pipeline | |
| import gradio as gr | |
| classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli") | |
| def zshot (text, labels): | |
| result = ([text, classifier(text, labels)['labels'][0]]) | |
| return(result) | |
| app = gr.Interface( | |
| zshot, | |
| inputs=[ | |
| gr.Textbox(label="Text", value=""), | |
| gr.Textbox(label="Label", value="['Food,Travel,Movie']"), | |
| ], | |
| outputs=["text"], | |
| ) | |
| app.launch() | |