File size: 595 Bytes
7f0f575 64fa930 7f0f575 64fa930 7f0f575 64fa930 7f0f575 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from TTS.api import TTS
# Load a CoquiTTS model
tts = TTS("tts_models/en/ljspeech/tacotron2-DDC")
def convert_text_to_speech(text):
output_path = "output.wav"
tts.tts_to_file(text=text, file_path=output_path)
return output_path # Return file path instead of waveform data
interface = gr.Interface(
fn=convert_text_to_speech,
inputs=gr.Textbox(label="Enter Text"),
outputs=gr.Audio(label="Generated Speech"),
title="Text to Speech Converter",
description="Enter text and generate speech using Hugging Face's models.",
)
interface.launch()
|