Xcds17-sd / app.py
Emalawi19's picture
Update app.py
4259885 verified
Raw
History Blame Contribute Delete
580 Bytes
import gradio as gr
from transformers import pipeline
import soundfile as sf
# Load Text-to-Speech model
tts = pipeline("text-to-speech", model="facebook/mms-tts-eng")
def text_to_voice(text):
speech = tts(text)
file_path = "speech.wav"
sf.write(file_path, speech["audio"], speech["sampling_rate"])
return file_path
demo = gr.Interface(
fn=text_to_voice,
inputs=gr.Textbox(label="Enter Text"),
outputs=gr.Audio(label="Generated Voice"),
title="Emalawi19 Text to Voice AI",
description="Type text and the AI will speak it."
)
demo.launch()