Olfat's picture
Create app.py
62b8385
raw
history blame
582 Bytes
from transformers import pipeline
import gradio as grad
zero_shot_classifier = pipeline("zero-shot-classification")
def classify(text,labels):
classifer_labels = labels.split(",")
#["time", "procreation", "love", "beauty"]
response = zero_shot_classifier(text,classifer_labels)
return response
txt=grad.Textbox(lines=1, label="English", placeholder="Shakespearean Sonnet")
labels=grad.Textbox(lines=1, label="Labels", placeholder="comma separated labels")
out=grad.Textbox(lines=1, label="Theme")
grad.Interface(classify, inputs=[txt,labels], outputs=out).launch()