Spaces:
Runtime error
Runtime error
| from transformers import pipeline | |
| import gradio as gr | |
| import os | |
| token = os.environ["token"] | |
| classifier = pipeline("zero-shot-classification", | |
| model="joeddav/xlm-roberta-large-xnli",use_auth_token=token) | |
| def classify(text, intent_labels): | |
| res = classifier(text, intent_labels) | |
| results = {k: v for k, v in zip(res["labels"], res["scores"])} | |
| return results | |
| # input is two text boxes, one for the text and one for the labels | |
| gr.Interface(fn=classify, inputs=["textbox", "textbox"], outputs="label").launch() | |