Spaces:
Runtime error
Runtime error
Avik Rao
commited on
Commit
·
a736250
1
Parent(s):
2073144
Fix variable name
Browse files
app.py
CHANGED
|
@@ -2,13 +2,12 @@
|
|
| 2 |
import streamlit as st
|
| 3 |
from streamlit_tags import st_tags
|
| 4 |
|
| 5 |
-
#
|
| 6 |
import json
|
| 7 |
|
| 8 |
# CUSTOM
|
| 9 |
from nlp.nlp import get_nearest_tags
|
| 10 |
|
| 11 |
-
|
| 12 |
f = open('nlp/tags.json') # OPEN JSON FILE
|
| 13 |
|
| 14 |
data = json.load(f) # LOAD DATA
|
|
@@ -33,33 +32,33 @@ st.write("Enter Genre(s), Mood/Theme(s), and Instrument(s)")
|
|
| 33 |
instructions = "Press ENTER to add more"
|
| 34 |
|
| 35 |
genre = st_tags(
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
|
| 43 |
mood = st_tags(
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
instrument = st_tags(
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
# SUBMIT TAGS
|
| 60 |
if st.button("Submit Tags"):
|
| 61 |
st.write("Tags are:")
|
| 62 |
inp = genre + mood + instrument
|
| 63 |
st.write("Before: " + str(inp))
|
| 64 |
-
|
| 65 |
-
st.write("After: " + str(
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from streamlit_tags import st_tags
|
| 4 |
|
| 5 |
+
# PYTHON STUFF
|
| 6 |
import json
|
| 7 |
|
| 8 |
# CUSTOM
|
| 9 |
from nlp.nlp import get_nearest_tags
|
| 10 |
|
|
|
|
| 11 |
f = open('nlp/tags.json') # OPEN JSON FILE
|
| 12 |
|
| 13 |
data = json.load(f) # LOAD DATA
|
|
|
|
| 32 |
instructions = "Press ENTER to add more"
|
| 33 |
|
| 34 |
genre = st_tags(
|
| 35 |
+
label='Enter Genre(s):',
|
| 36 |
+
text=instructions,
|
| 37 |
+
suggestions=GENRE_TAGS,
|
| 38 |
+
maxtags=MAX_TAGS,
|
| 39 |
+
key='1'
|
| 40 |
+
)
|
| 41 |
|
| 42 |
mood = st_tags(
|
| 43 |
+
label='Enter Mood/Theme(s):',
|
| 44 |
+
text=instructions,
|
| 45 |
+
suggestions=MOOD_TAGS,
|
| 46 |
+
maxtags=MAX_TAGS,
|
| 47 |
+
key='2'
|
| 48 |
+
)
|
| 49 |
|
| 50 |
instrument = st_tags(
|
| 51 |
+
label='Enter Instrument(s):',
|
| 52 |
+
text=instructions,
|
| 53 |
+
suggestions=INSTRUMENT_TAGS,
|
| 54 |
+
maxtags=MAX_TAGS,
|
| 55 |
+
key='3'
|
| 56 |
+
)
|
| 57 |
|
| 58 |
# SUBMIT TAGS
|
| 59 |
if st.button("Submit Tags"):
|
| 60 |
st.write("Tags are:")
|
| 61 |
inp = genre + mood + instrument
|
| 62 |
st.write("Before: " + str(inp))
|
| 63 |
+
input_tags = get_nearest_tags(inp)
|
| 64 |
+
st.write("After: " + str(input_tags))
|