|
|
import gradio as gr |
|
|
from transformers import pipeline |
|
|
import scipy |
|
|
|
|
|
|
|
|
bark_pipe = pipeline("text-to-speech", model="suno/bark") |
|
|
|
|
|
def bark_tts(text): |
|
|
result = bark_pipe(text) |
|
|
|
|
|
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) |
|
|
|