from transformers import pipeline import gradio as gr model_checkpoint = "MuntasirHossain/RoBERTa-base-finetuned-emotion" model = pipeline("text-classification", model=model_checkpoint) def classify(text): label = model(text)[0]["label"] return label title = "Texts Expressing Emotion" iface = gr.Interface( fn=classify, inputs=gr.Textbox(), outputs=gr.Label(), title=title, ) iface.launch()