Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
from transformers import pipeline
|
| 3 |
-
|
| 4 |
-
# Initialize the text-to-audio pipeline with the musicgen model
|
| 5 |
-
pipe = pipeline("text-to-audio", model="facebook/musicgen-small")
|
| 6 |
-
|
| 7 |
-
# Define the function to generate audio from text
|
| 8 |
-
def generate_audio(text):
|
| 9 |
-
audio_output = pipe(text)
|
| 10 |
-
return audio_output["audio"]
|
| 11 |
-
|
| 12 |
-
# Set up the Gradio interface
|
| 13 |
-
app = gr.Interface(
|
| 14 |
-
fn=generate_audio, # Function to call for text-to-audio generation
|
| 15 |
-
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter text to generate audio"), # Input field for text
|
| 16 |
-
outputs=gr.outputs.Audio(type="numpy"), # Output as audio
|
| 17 |
-
title="Text to Audio Generator", # Title of the Gradio app
|
| 18 |
-
description="Generate music or audio from text using Facebook's MusicGen small model."
|
| 19 |
-
)
|
| 20 |
-
|
| 21 |
-
# Launch the app
|
| 22 |
-
if __name__ == "__main__":
|
| 23 |
-
app.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|