File size: 709 Bytes
8118795
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)