import gradio as gr from transformers import pipeline model_checkpoint = "MuntasirHossain/RoBERTa-base-finetuned-emotion" emotion_model = pipeline("text-classification", model=model_checkpoint) def classify_emotion(text): label = emotion_model(text)[0]["label"] return label description = "This AI model is trained to classify texts expressing human emotion into different categories." title = "Texts Expressing Emotion" examples = [["He is very happy today", "Free Palestine"]] theme = { "container": { "background-color": "#007bff", "color": "#fff", "padding": "20px", }, "textbox": { "background-color": "#fff", "border-radius": "5px", "padding": "10px", "margin-bottom": "10px", }, "button": { "background-color": "#007bff", "color": "#fff", "padding": "10px", "border-radius": "5px", "cursor": "pointer", }, "label": { "color": "#fff", }, } gr.Interface( fn=classify_emotion, inputs="textbox", outputs="text", title=title, theme=theme, description=description, examples=examples, ).launch()