File size: 442 Bytes
89c4aad |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
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() |