lg3394's picture
Update app.py
d4cf7bb verified
raw
history blame
450 Bytes
import gradio as gr
from transformers import pipeline
classifier = pipeline("zero-shot-classification",
model="facebook/bart-large-mnli")
def do_action(text):
candidate_labels = ['gun control', 'abortion', 'gender transition', 'freedom of speech', 'immigration', 'taxes']
result = classifier(text, candidate_labels)
return result
iface = gr.Interface(fn=do_action, inputs="text", outputs="text")
iface.launch()