Spaces:
Runtime error
Runtime error
Commit
·
d2ac7fa
1
Parent(s):
3b61fe2
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,26 +13,38 @@ def tester(text):
|
|
| 13 |
#tester(emo)
|
| 14 |
generator = st.button("Generate Song!")
|
| 15 |
if (generator == True):
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
with open('angryplaylist.txt') as f:
|
| 18 |
contents = f.read()
|
| 19 |
-
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
emo = st.text_input("Enter a text/phrase/sentence. A corresponding song will be recommended based on its emotion.", placeholder="tester po")
|
| 24 |
-
#submit = st.form_submit_button("Generate Playlist!")
|
| 25 |
|
| 26 |
tester(emo)
|
| 27 |
|
| 28 |
-
|
| 29 |
-
#def finder(ome):
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
#finder(tester(emo))
|
| 36 |
-
|
| 37 |
|
| 38 |
|
|
|
|
| 13 |
#tester(emo)
|
| 14 |
generator = st.button("Generate Song!")
|
| 15 |
if (generator == True):
|
| 16 |
+
|
| 17 |
+
if (results[0]['label']=="joy"): #songs for joy emotion
|
| 18 |
+
with open('joyplaylist.txt') as f:
|
| 19 |
+
contents = f.read()
|
| 20 |
+
components.html(contents,width=560,height=325)
|
| 21 |
+
|
| 22 |
+
elif (results[0]['label']=="fear"):
|
| 23 |
+
with open('fearplaylist.txt') as f:
|
| 24 |
+
contents = f.read()
|
| 25 |
+
components.html(contents,width=560,height=325)
|
| 26 |
+
|
| 27 |
+
elif (results[0]['label']=="anger"): #songs for anger emotion
|
| 28 |
with open('angryplaylist.txt') as f:
|
| 29 |
contents = f.read()
|
| 30 |
+
components.html(contents,width=560,height=325)
|
| 31 |
|
| 32 |
+
elif (results[0]['label']=="sadness"): #songs for sadness emotion
|
| 33 |
+
with open('sadplaylist.txt') as f:
|
| 34 |
+
contents = f.read()
|
| 35 |
+
components.html(contents,width=560,height=325)
|
| 36 |
|
| 37 |
+
elif (results[0]['label']=="surprise"):
|
| 38 |
+
st.write("gulat ka noh")
|
| 39 |
+
|
| 40 |
+
elif (results[0]['label']=="love"):
|
| 41 |
+
with open('loveplaylist.txt') as f:
|
| 42 |
+
contents = f.read()
|
| 43 |
+
components.html(contents,width=560,height=325)
|
| 44 |
+
|
| 45 |
emo = st.text_input("Enter a text/phrase/sentence. A corresponding song will be recommended based on its emotion.", placeholder="tester po")
|
|
|
|
| 46 |
|
| 47 |
tester(emo)
|
| 48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
|