Spaces:
Sleeping
Sleeping
Tirath5504
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,7 @@ def generate(prompt):
|
|
34 |
return audio_buffer
|
35 |
|
36 |
st.title("Music Generator")
|
|
|
37 |
|
38 |
text_prompt = st.text_input("Text Prompt", "")
|
39 |
|
@@ -42,18 +43,19 @@ examples = [
|
|
42 |
"Earthy tones, environmentally conscious, ukulele-infused, harmonic, breezy, easygoing, organic instrumentation, gentle grooves",
|
43 |
"90s rock song with loud guitars and heavy drums",
|
44 |
"Heartful EDM with beautiful synths and chords",
|
|
|
45 |
]
|
46 |
|
47 |
st.title("Examples")
|
48 |
selected_example = st.radio("Select an example", examples)
|
49 |
|
50 |
if st.button("Generate Audio"):
|
51 |
-
if selected_example or text_prompt:
|
52 |
prompt = ""
|
53 |
-
if
|
54 |
-
prompt = selected_example
|
55 |
-
else:
|
56 |
prompt = text_prompt
|
|
|
|
|
57 |
with st.spinner("Generating audio..."):
|
58 |
audio_output = generate(prompt)
|
59 |
st.audio(audio_output, format='audio/wav')
|
@@ -62,6 +64,6 @@ if st.button("Generate Audio"):
|
|
62 |
|
63 |
if st.checkbox("Show debug info"):
|
64 |
if text_prompt:
|
65 |
-
st.write("
|
66 |
-
|
67 |
-
st.write("
|
|
|
34 |
return audio_buffer
|
35 |
|
36 |
st.title("Music Generator")
|
37 |
+
st.header("Select an example or write a text prompt")
|
38 |
|
39 |
text_prompt = st.text_input("Text Prompt", "")
|
40 |
|
|
|
43 |
"Earthy tones, environmentally conscious, ukulele-infused, harmonic, breezy, easygoing, organic instrumentation, gentle grooves",
|
44 |
"90s rock song with loud guitars and heavy drums",
|
45 |
"Heartful EDM with beautiful synths and chords",
|
46 |
+
"None"
|
47 |
]
|
48 |
|
49 |
st.title("Examples")
|
50 |
selected_example = st.radio("Select an example", examples)
|
51 |
|
52 |
if st.button("Generate Audio"):
|
53 |
+
if selected_example != "None" or text_prompt:
|
54 |
prompt = ""
|
55 |
+
if text_prompt:
|
|
|
|
|
56 |
prompt = text_prompt
|
57 |
+
else:
|
58 |
+
prompt = selected_example
|
59 |
with st.spinner("Generating audio..."):
|
60 |
audio_output = generate(prompt)
|
61 |
st.audio(audio_output, format='audio/wav')
|
|
|
64 |
|
65 |
if st.checkbox("Show debug info"):
|
66 |
if text_prompt:
|
67 |
+
st.write("Prompt:", text_prompt)
|
68 |
+
else:
|
69 |
+
st.write("Prompt:", selected_example)
|