File size: 389 Bytes
d53cef4
7258dcc
d53cef4
7258dcc
 
d53cef4
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 = ['travel', 'cooking', 'dancing']
    result = classifier(text, candidate_labels)

    return result

iface = gr.Interface(fn=do_action, inputs="text", outputs="text")
iface.launch()