import gradio as gr | |
from transformers import pipeline | |
def classify(text): | |
classifier = pipeline("zero-shot-classification") | |
candidate_labels = ["positive", "negative", "neutral"] | |
output = classifier(text, candidate_labels) | |
return output | |
demo = gr.Interface(fn=classify, | |
inputs=gr.Textbox(label="Enter something"), | |
outputs=gr.Label(num_top_classes=3)) | |
demo.launch() |