File size: 433 Bytes
71a175a
 
 
d6b7c68
 
71a175a
d6b7c68
71a175a
 
ade7e0a
71a175a
 
d6b7c68
71a175a
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from transformers import pipeline
import gradio as gr

pertrained_model = "MuntasirHossain/RoBERTa-base-finetuned-emotion"
model = pipeline("text-classification", model=pertrained_model)

def detect_emotions(text):
    label = model(text)[0]["label"]
    return label
title = "Texts Expressing Emotion"

iface = gr.Interface(
    fn=detect_emotions,
    inputs=gr.Textbox(),
    outputs=gr.Label(),
    title=title,
)
iface.launch()