Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -55,9 +55,8 @@ async def generate_music(prompt, bpm, temperature):
|
|
| 55 |
output_path = "generated_music.wav"
|
| 56 |
save_wave_file(output_path, all_pcm)
|
| 57 |
|
| 58 |
-
# Return
|
| 59 |
-
|
| 60 |
-
return (24000, audio_np), output_path, "Music generated successfully!"
|
| 61 |
|
| 62 |
except Exception as e:
|
| 63 |
return None, None, f"Error: {str(e)}"
|
|
@@ -68,11 +67,11 @@ def generate_music_gradio(prompt, bpm, temperature):
|
|
| 68 |
return loop.run_until_complete(generate_music(prompt, bpm, temperature))
|
| 69 |
|
| 70 |
# Gradio UI
|
| 71 |
-
with gr.Blocks(title="
|
| 72 |
-
gr.Markdown("##
|
| 73 |
|
| 74 |
with gr.Group():
|
| 75 |
-
gr.Markdown("###
|
| 76 |
with gr.Row():
|
| 77 |
prompt_input = gr.Textbox(
|
| 78 |
label="Music Style / Prompt",
|
|
@@ -84,14 +83,14 @@ with gr.Blocks(title="π΅ Gemini Lyria Music Generator") as demo:
|
|
| 84 |
generate_btn = gr.Button("π§ Generate Music")
|
| 85 |
|
| 86 |
with gr.Group():
|
| 87 |
-
gr.Markdown("###
|
| 88 |
with gr.Row():
|
| 89 |
-
output_audio = gr.Audio(label="Generated Audio", type="
|
| 90 |
download_file = gr.File(label="Download WAV")
|
| 91 |
status_output = gr.Textbox(label="Status", interactive=False)
|
| 92 |
|
| 93 |
with gr.Group():
|
| 94 |
-
gr.Markdown("###Try These Examples")
|
| 95 |
examples = gr.Examples(
|
| 96 |
examples=[
|
| 97 |
["ambient synth in a forest", 100, 1.2],
|
|
|
|
| 55 |
output_path = "generated_music.wav"
|
| 56 |
save_wave_file(output_path, all_pcm)
|
| 57 |
|
| 58 |
+
# Return file path for both playback and download
|
| 59 |
+
return output_path, output_path, "Music generated successfully!"
|
|
|
|
| 60 |
|
| 61 |
except Exception as e:
|
| 62 |
return None, None, f"Error: {str(e)}"
|
|
|
|
| 67 |
return loop.run_until_complete(generate_music(prompt, bpm, temperature))
|
| 68 |
|
| 69 |
# Gradio UI
|
| 70 |
+
with gr.Blocks(title="Gemini Lyria Music Generator") as demo:
|
| 71 |
+
gr.Markdown("## Gemini Lyria Music Generator")
|
| 72 |
|
| 73 |
with gr.Group():
|
| 74 |
+
gr.Markdown("### Prompt & Controls")
|
| 75 |
with gr.Row():
|
| 76 |
prompt_input = gr.Textbox(
|
| 77 |
label="Music Style / Prompt",
|
|
|
|
| 83 |
generate_btn = gr.Button("π§ Generate Music")
|
| 84 |
|
| 85 |
with gr.Group():
|
| 86 |
+
gr.Markdown("### Output")
|
| 87 |
with gr.Row():
|
| 88 |
+
output_audio = gr.Audio(label="Generated Audio", type="filepath")
|
| 89 |
download_file = gr.File(label="Download WAV")
|
| 90 |
status_output = gr.Textbox(label="Status", interactive=False)
|
| 91 |
|
| 92 |
with gr.Group():
|
| 93 |
+
gr.Markdown("### Try These Examples")
|
| 94 |
examples = gr.Examples(
|
| 95 |
examples=[
|
| 96 |
["ambient synth in a forest", 100, 1.2],
|