shawarmabytes commited on
Commit
2ecd65e
1 Parent(s): 0ebbd67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -8,27 +8,26 @@ def tester(text):
8
  #classifier = pipeline("sentiment-analysis", model='arpanghoshal/EmoRoBERTa')
9
  #classifier = pipeline("sentiment-analysis", model='cardiffnlp/twitter-roberta-base-emotion')
10
  #classifier = pipeline("sentiment-analysis", 'j-hartmann/emotion-english-distilroberta-base')
11
- classifier = pipeline("sentiment-analysis", model='cardiffnlp/twitter-roberta-base-emotion')
12
 
13
-
14
-
15
  results = classifier(text)
16
  st.write(results[0]['label'])
17
 
18
  if (results[0]['label']=="anger"):
19
- st_player("https://youtu.be/CmSKVW1v0xM")
20
 
21
  elif (results[0]['label']=="disgust"):
22
- st_player("https://youtu.be/CmSKVW1v0xM")
23
 
24
  elif (results[0]['label']=="fear"):
25
- st_player("https://youtu.be/CmSKVW1v0xM")
26
 
27
  elif (results[0]['label']=="joy"):
28
- st_player("https://youtu.be/CmSKVW1v0xM")
29
 
30
  elif (results[0]['label']=="sadness"):
31
- st_player("https://open.spotify.com/playlist/37i9dQZF1E4s6KXygylRFz")
32
 
33
  elif (results[0]['label']=="surprise"):
34
  st_player("https://youtu.be/CmSKVW1v0xM")
@@ -37,7 +36,7 @@ def tester(text):
37
  return results[0]['label']
38
  #return results
39
 
40
- emo = st.text_input('Enter text here:')
41
  tester(emo)
42
 
43
 
 
8
  #classifier = pipeline("sentiment-analysis", model='arpanghoshal/EmoRoBERTa')
9
  #classifier = pipeline("sentiment-analysis", model='cardiffnlp/twitter-roberta-base-emotion')
10
  #classifier = pipeline("sentiment-analysis", 'j-hartmann/emotion-english-distilroberta-base')
11
+ classifier = pipeline("sentiment-analysis", model='bhadresh-savani/distilbert-base-uncased-emotion')
12
 
13
+
 
14
  results = classifier(text)
15
  st.write(results[0]['label'])
16
 
17
  if (results[0]['label']=="anger"):
18
+ st_player("https://www.youtube.com/watch?v=kh0BWQ4Uo6w")
19
 
20
  elif (results[0]['label']=="disgust"):
21
+ st_player("https://www.youtube.com/watch?v=zWq2TT3ieGE")
22
 
23
  elif (results[0]['label']=="fear"):
24
+ st_player("https://www.youtube.com/watch?v=iyEUvUcMHgE")
25
 
26
  elif (results[0]['label']=="joy"):
27
+ st_player("https://www.youtube.com/watch?v=1k8craCGpgs")
28
 
29
  elif (results[0]['label']=="sadness"):
30
+ st_player("https://www.youtube.com/watch?v=BZsXcc_tC-oautoplay=1")
31
 
32
  elif (results[0]['label']=="surprise"):
33
  st_player("https://youtu.be/CmSKVW1v0xM")
 
36
  return results[0]['label']
37
  #return results
38
 
39
+ emo = st.text_input('This application detects the emotion in your text input and suggests a song that matches it. Please enter text below to try:')
40
  tester(emo)
41
 
42