ccc / app.py
arifather51's picture
Update app.py
37288b6 verified
raw
history blame contribute delete
558 Bytes
import gradio as gr
from TTS.api import TTS
# Initialize TTS model (default English)
tts = TTS(model_name="tts_models/en/ljspeech/tacotron2-DDC", progress_bar=False, gpu=False)
def text_to_speech(text):
output_file = "output.wav"
tts.tts_to_file(text=text, file_path=output_file)
return output_file
iface = gr.Interface(
fn=text_to_speech,
inputs=gr.Textbox(label="Enter Text"),
outputs=gr.Audio(label="Generated Speech"),
title="TTS with Python",
description="Type text and get speech using TTS==0.13.0"
)
iface.launch()