Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -49,10 +49,10 @@ def generate_music(prompt, max_new_tokens: int = 128):
|
|
49 |
return sampling_rate, audio
|
50 |
|
51 |
# Combined Gradio function
|
52 |
-
def main(user_input):
|
53 |
detailed_prompt = refine_prompt(user_input)
|
54 |
-
sampling_rate, audio = generate_music(detailed_prompt)
|
55 |
-
return detailed_prompt, (sampling_rate, audio)
|
56 |
|
57 |
# Build Gradio UI
|
58 |
with gr.Blocks() as demo:
|
@@ -65,13 +65,13 @@ Enter a music idea or mood and get a short AI-generated track. (CPU mode)""")
|
|
65 |
|
66 |
refined_output = gr.Textbox(label="Enhanced Prompt by GPT")
|
67 |
audio_output = gr.Audio(label="Generated Audio", type="numpy")
|
68 |
-
download_wav = gr.File(label="Download .wav file"
|
69 |
|
70 |
generate_btn.click(
|
71 |
-
|
72 |
inputs=[user_input, max_tokens],
|
73 |
outputs=[refined_output, audio_output, download_wav]
|
74 |
)
|
75 |
|
76 |
-
# Launch in SSR mode
|
77 |
demo.launch(server_name="0.0.0.0", server_port=7860, share=False, enable_queue=True)
|
|
|
49 |
return sampling_rate, audio
|
50 |
|
51 |
# Combined Gradio function
|
52 |
+
def main(user_input, max_new_tokens):
|
53 |
detailed_prompt = refine_prompt(user_input)
|
54 |
+
sampling_rate, audio = generate_music(detailed_prompt, max_new_tokens)
|
55 |
+
return detailed_prompt, (sampling_rate, audio), "/tmp/output.wav"
|
56 |
|
57 |
# Build Gradio UI
|
58 |
with gr.Blocks() as demo:
|
|
|
65 |
|
66 |
refined_output = gr.Textbox(label="Enhanced Prompt by GPT")
|
67 |
audio_output = gr.Audio(label="Generated Audio", type="numpy")
|
68 |
+
download_wav = gr.File(label="Download .wav file")
|
69 |
|
70 |
generate_btn.click(
|
71 |
+
main,
|
72 |
inputs=[user_input, max_tokens],
|
73 |
outputs=[refined_output, audio_output, download_wav]
|
74 |
)
|
75 |
|
76 |
+
# Launch in SSR mode with queue enabled
|
77 |
demo.launch(server_name="0.0.0.0", server_port=7860, share=False, enable_queue=True)
|