# app.py import gradio as gr import torch from TTS.api import TTS # Load Sinhala TTS model from Hugging Face tts = TTS(model_name="bhasha/sinhala-tts", progress_bar=False, gpu=False) def speak_sinhala(text): # Generate speech and return audio path output_path = "output.wav" tts.tts_to_file(text=text, file_path=output_path) return output_path # Sinhala UI Labels gr.Interface( fn=speak_sinhala, inputs=gr.Textbox(label="සිංහල වාක්‍යය ඇතුළත් කරන්න"), outputs=gr.Audio(type="filepath", label="ඔබේ හඬ"), title="සිංහල වචන → හඬ", description="ඔබගේ සිංහල වචන කීපයක් ඇතුළත් කරන්න. මෙම යෙදුම ඒවා හඬක් ලෙස නිකුත් කරයි." ).launch()