aymen12 commited on
Commit
d6b7c68
·
1 Parent(s): ade7e0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -1,21 +1,18 @@
1
  from transformers import pipeline
2
  import gradio as gr
3
 
4
- model_checkpoint = "MuntasirHossain/RoBERTa-base-finetuned-emotion"
5
- model = pipeline("text-classification", model=model_checkpoint)
6
 
7
- def classify(text):
8
  label = model(text)[0]["label"]
9
  return label
10
-
11
-
12
  title = "Texts Expressing Emotion"
13
 
14
  iface = gr.Interface(
15
- fn=classify,
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()