Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
-
|
5 |
-
model = pipeline("text-classification", model=
|
6 |
|
7 |
-
def
|
8 |
label = model(text)[0]["label"]
|
9 |
return label
|
10 |
-
|
11 |
-
|
12 |
title = "Texts Expressing Emotion"
|
13 |
|
14 |
iface = gr.Interface(
|
15 |
-
fn=
|
16 |
inputs=gr.Textbox(),
|
17 |
outputs=gr.Label(),
|
18 |
title=title,
|
19 |
)
|
20 |
-
|
21 |
iface.launch()
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
pertrained_model = "MuntasirHossain/RoBERTa-base-finetuned-emotion"
|
5 |
+
model = pipeline("text-classification", model=pertrained_model)
|
6 |
|
7 |
+
def detect_emotions(text):
|
8 |
label = model(text)[0]["label"]
|
9 |
return label
|
|
|
|
|
10 |
title = "Texts Expressing Emotion"
|
11 |
|
12 |
iface = gr.Interface(
|
13 |
+
fn=detect_emotions,
|
14 |
inputs=gr.Textbox(),
|
15 |
outputs=gr.Label(),
|
16 |
title=title,
|
17 |
)
|
|
|
18 |
iface.launch()
|