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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -4
app.py CHANGED
@@ -1,6 +1,21 @@
1
  import gradio as gr
 
2
 
3
- gr.load(
4
- "models/facebook/musicgen-small",
5
- provider="hf-inference",
6
- ).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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__":
21
+ iface.launch()