IMAGEIN / app.py
Bagda's picture
Create app.py
8118795 verified
raw
history blame
709 Bytes
import gradio as gr
from transformers import pipeline
import scipy
# Suno Bark text-to-speech pipeline load करें
bark_pipe = pipeline("text-to-speech", model="suno/bark")
def bark_tts(text):
result = bark_pipe(text)
# WAV file return करें (Gradio को binary चाहिए)
scipy.io.wavfile.write("output.wav", result["sampling_rate"], result["audio"])
return "output.wav"
iface = gr.Interface(
fn=bark_tts,
inputs=gr.Textbox(label="Enter text (Hindi/English)"),
outputs=gr.Audio(type="filepath", label="Generated Speech"),
title="Suno Bark Text-to-Speech Demo"
)
if __name__ == "__main__":
iface.launch(server_name="0.0.0.0", server_port=7860)