import gradio as gr | |
from transformers import pipeline | |
classifier = pipeline("text-classification", model="SamLowe/roberta-base-go_emotions") | |
def predict(text): | |
result = classifier(text) | |
print(f"{result}") | |
return result | |
demo = gr.Interface( | |
fn = predict, | |
inputs = 'text', | |
outputs = 'text', | |
) | |
# demo = gr.Interface.from_pipeline(classifier) | |
demo.launch() |