Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,20 +1,20 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
# Load the
|
| 5 |
-
|
| 6 |
|
| 7 |
-
def
|
| 8 |
-
output =
|
| 9 |
return output["audio"]
|
| 10 |
|
| 11 |
# Create Gradio interface
|
| 12 |
iface = gr.Interface(
|
| 13 |
-
fn=
|
| 14 |
-
inputs=gr.Textbox(label="Enter
|
| 15 |
-
outputs=gr.Audio(label="Generated
|
| 16 |
-
title="
|
| 17 |
-
description="Enter
|
| 18 |
)
|
| 19 |
|
| 20 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
# Load the MusicGen model
|
| 5 |
+
musicgen = pipeline("text-to-audio", model="facebook/musicgen-small")
|
| 6 |
|
| 7 |
+
def text_to_music(prompt):
|
| 8 |
+
output = musicgen(prompt)
|
| 9 |
return output["audio"]
|
| 10 |
|
| 11 |
# Create Gradio interface
|
| 12 |
iface = gr.Interface(
|
| 13 |
+
fn=text_to_music,
|
| 14 |
+
inputs=gr.Textbox(label="Enter a music description"),
|
| 15 |
+
outputs=gr.Audio(label="Generated Music"),
|
| 16 |
+
title="AI Music Generator",
|
| 17 |
+
description="Enter a description (e.g., 'happy jazz melody') and generate AI music."
|
| 18 |
)
|
| 19 |
|
| 20 |
if __name__ == "__main__":
|