wendys-llc's picture
Update app.py
c7102bb
import gradio as gr
from transformers import pipeline
def do_action(text):
classifier = pipeline("zero-shot-classification",
model="facebook/bart-large-mnli")
candidate_labels = ['gun control', 'abortion', 'gender transition', 'freedom of speech', 'immigration', 'taxes']
result = classifier(text, candidate_labels)
result = dict(zip(result['labels'], result['scores']))
return result
iface = gr.Interface(fn=do_action, inputs="text", outputs="label")
iface.launch()