Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
import scipy
|
| 4 |
+
|
| 5 |
+
# Suno Bark text-to-speech pipeline load करें
|
| 6 |
+
bark_pipe = pipeline("text-to-speech", model="suno/bark")
|
| 7 |
+
|
| 8 |
+
def bark_tts(text):
|
| 9 |
+
result = bark_pipe(text)
|
| 10 |
+
# WAV file return करें (Gradio को binary चाहिए)
|
| 11 |
+
scipy.io.wavfile.write("output.wav", result["sampling_rate"], result["audio"])
|
| 12 |
+
return "output.wav"
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(
|
| 15 |
+
fn=bark_tts,
|
| 16 |
+
inputs=gr.Textbox(label="Enter text (Hindi/English)"),
|
| 17 |
+
outputs=gr.Audio(type="filepath", label="Generated Speech"),
|
| 18 |
+
title="Suno Bark Text-to-Speech Demo"
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|
| 23 |
+
|