MadhavManoj commited on
Commit
c3dc362
·
verified ·
1 Parent(s): fab9757

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -1,20 +1,20 @@
1
  import gradio as gr
2
  from transformers import pipeline
3
 
4
- # Load the text-to-audio model
5
- tts = pipeline("text-to-audio", model="facebook/musicgen-small")
6
 
7
- def text_to_audio(text):
8
- output = tts(text)
9
  return output["audio"]
10
 
11
  # Create Gradio interface
12
  iface = gr.Interface(
13
- fn=text_to_audio,
14
- inputs=gr.Textbox(label="Enter Text"),
15
- outputs=gr.Audio(label="Generated Audio"),
16
- title="Text-to-Audio Chatbot",
17
- description="Enter text, and get an AI-generated audio response."
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__":