File size: 450 Bytes
d53cef4
7258dcc
d53cef4
7258dcc
 
d53cef4
7258dcc
d4cf7bb
7258dcc
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()