File size: 1,359 Bytes
6a9646d
fca1098
 
6a9646d
a736250
fca1098
 
6a9646d
67a7ce9
6a9646d
c63f044
fca1098
 
 
6a9646d
fca1098
 
 
 
 
 
 
 
 
 
 
 
 
611c15c
 
 
 
a736250
 
 
 
 
 
611c15c
 
a736250
 
 
 
 
 
611c15c
 
a736250
 
 
 
 
 
611c15c
 
 
 
 
 
a736250
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# STREAMLIT STUFF
import streamlit as st
from streamlit_tags import st_tags

# PYTHON STUFF
import json

# CUSTOM
from nlp.nlp import get_nearest_tags

f = open('nlp/tags.json')        # OPEN JSON FILE
data = json.load(f)             # LOAD DATA
f.close()                       # CLOSE FILE

# --------------------------- VARIABLES / MACROS

# SPLIT DATA
GENRE_TAGS = data['genre']
MOOD_TAGS = data['mood']
INSTRUMENT_TAGS = data['instrument']

MAX_TAGS = 3

# --------------------------- TITLE
st.title("FIRE COML FALL 2022 Audio Generation Model")

# --------------------------- MAIN
# SELECT TYPE OF GENERATION
st.write("Enter Genre(s), Mood/Theme(s), and Instrument(s)")
instructions = "Press ENTER to add more"

genre = st_tags(
    label='Enter Genre(s):',
    text=instructions,
    suggestions=GENRE_TAGS,
    maxtags=MAX_TAGS,
    key='1'
)

mood = st_tags(
    label='Enter Mood/Theme(s):',
    text=instructions,
    suggestions=MOOD_TAGS,
    maxtags=MAX_TAGS,
    key='2'
)

instrument = st_tags(
    label='Enter Instrument(s):',
    text=instructions,
    suggestions=INSTRUMENT_TAGS,
    maxtags=MAX_TAGS,
    key='3'
)

# SUBMIT TAGS
if st.button("Submit Tags"):
    st.write("Tags are:")
    inp = genre + mood + instrument
    st.write("Before: " + str(inp))
    input_tags = get_nearest_tags(inp)
    st.write("After: " + str(input_tags))