File size: 1,924 Bytes
fca1098
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
64
65
66
67
68
69
70
71
72
73
74
75
import streamlit as st
from streamlit_tags import st_tags
import json


f = open('tag_map.json')        # OPEN JSON FILE

data = json.load(f)             # LOAD DATA

f.close()                       # CLOSE FILE

# --------------------------- VARIABLES

# 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
option = st.selectbox("Select Generation type:", ("Sentence Based", "Tag Based"))

# SENTENCE BASED 
if option == "Sentence Based":
    input_sentence = st.text_input("Enter a description for a song you want to hear:")

    # SUBMIT DESCRIPTION
    if st.button("Submit Description"):
        if input_sentence is not None and len(input_sentence) > 0:
            st.write("Here is the generated audio: ")
            st.write(input_sentence)
        else:
            st.write("Invalid Description")

# TAG BASED
else:
    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:")
        input = genre + mood + instrument
        st.write(str(input))