robertjd's picture
Initial commit.
0c2b6e1
raw
history blame contribute delete
No virus
509 Bytes
import gradio
import gradio as gr
from transformers import pipeline
classifier = pipeline("zero-shot-classification", model="MoritzLaurer/deberta-v3-large-zeroshot-v1")
def classify(review, candidate_labels=('positive', 'neutral', 'negative')):
labels = classifier(review, candidate_labels)
return gradio.Label(label='Classification', value=(dict(zip(labels['labels'], labels['scores']))))
app = gr.Interface(fn=classify, inputs=['text'], outputs=['label'], allow_flagging="never")
app.launch()