Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import os
|
|
| 7 |
|
| 8 |
# --- AI Model Setup ---
|
| 9 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 10 |
-
print(f"Device set to use {device}")
|
| 11 |
pipe = pipeline("text-to-audio", "facebook/musicgen-small", device=device)
|
| 12 |
|
| 13 |
# --- Music Generation Function ---
|
|
@@ -35,10 +35,10 @@ iface = gr.Interface(
|
|
| 35 |
gr.Textbox(lines=2, label="Music Description", placeholder="e.g., A futuristic synthwave track..."),
|
| 36 |
gr.Slider(minimum=2, maximum=60, value=15, label="Duration (seconds)")
|
| 37 |
],
|
| 38 |
-
outputs=gr.Audio(type="filepath", label="Generated Music"),
|
| 39 |
title="MusicGen AI",
|
| 40 |
description="Transform your ideas into music with AI. Describe a sound and set the duration to get started.",
|
| 41 |
-
allow_flagging=
|
| 42 |
)
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|
|
|
|
| 7 |
|
| 8 |
# --- AI Model Setup ---
|
| 9 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
| 10 |
+
print(f"Device set to use {device}")
|
| 11 |
pipe = pipeline("text-to-audio", "facebook/musicgen-small", device=device)
|
| 12 |
|
| 13 |
# --- Music Generation Function ---
|
|
|
|
| 35 |
gr.Textbox(lines=2, label="Music Description", placeholder="e.g., A futuristic synthwave track..."),
|
| 36 |
gr.Slider(minimum=2, maximum=60, value=15, label="Duration (seconds)")
|
| 37 |
],
|
| 38 |
+
outputs=gr.Audio(type="filepath", label="Generated Music", downloadable=True), # Download button enabled here
|
| 39 |
title="MusicGen AI",
|
| 40 |
description="Transform your ideas into music with AI. Describe a sound and set the duration to get started.",
|
| 41 |
+
allow_flagging="never"
|
| 42 |
)
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|