NotSoundRated's picture
Update app.py
0514662 verified
raw
history blame contribute delete
439 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli", device=1)
def classify(text, labels):
return classifier(text, candidate_labels=labels)
iface = gr.Interface(
fn=classify,
inputs=[gr.Text(label="Text"), gr.Textbox(lines=1, label="Candidate Labels (comma-separated)")],
outputs="json"
)
if __name__ == "__main__":
iface.launch()