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