import gradio as gr | |
from TTS.api import TTS | |
# Sinhala voice model (or English if Sinhala not available) | |
model_name = "tts_models/en/ljspeech/tacotron2-DDC" | |
tts = TTS(model_name) | |
def text_to_speech(text): | |
path = tts.tts_to_file(text=text, file_path="output.wav") | |
return "output.wav" | |
gr.Interface( | |
fn=text_to_speech, | |
inputs=gr.Textbox(label="Enter Text"), | |
outputs=gr.Audio(type="filepath", label="Generated Voice"), | |
title="Multilingual Text to Speech", | |
description="Convert text to natural human-like voice! Free and Unlimited!" | |
).launch() | |