Spaces:
Runtime error
Runtime error
File size: 1,173 Bytes
785faa9 ff78663 ab11305 ff78663 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
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()
|