File size: 484 Bytes
4ffb672
 
6eb0648
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
pip install transformers
pip install gradio
from transformers import pipeline
import gradio as gr
classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")

def zshot (text, labels):
  result = ([text, classifier(text, labels)['labels'][0]])
  return(result)

app = gr.Interface(
    zshot,
    inputs=[
        gr.Textbox(label="Text", value=""),
        gr.Textbox(label="Label", value="['Food,Travel,Movie']"),
    ],
    outputs=["text"],
)
app.launch()