|
import gradio as gr |
|
from config import custom_css |
|
from synthesis import generate_speech |
|
|
|
def create_interface(): |
|
with gr.Blocks(title="Persian Text-to-Speech", css=custom_css) as demo: |
|
gr.Markdown("# Persian Text-to-Speech with Tacotron2 and HiFiGAN") |
|
|
|
with gr.Row(): |
|
with gr.Column(scale=2): |
|
text_input = gr.Textbox( |
|
label="Persian Text", |
|
placeholder="مدل تولید گفتار با دادگان نسل مانا", |
|
lines=5 |
|
) |
|
|
|
generate_btn = gr.Button("Generate Speech", variant="primary") |
|
|
|
with gr.Column(scale=2): |
|
audio_output = gr.Audio(label="Generated Speech") |
|
|
|
generate_btn.click( |
|
fn=generate_speech, |
|
inputs=[text_input], |
|
outputs=[audio_output] |
|
) |
|
|
|
gr.Examples( |
|
examples=[ |
|
["سلام، چطور هستید؟"], |
|
["ایران سرزمین زیباییها و افتخارات است."], |
|
["فناوری هوش مصنوعی به سرعت در حال پیشرفت است."], |
|
["مدل تولید گفتار با دادگان نسل مانا"] |
|
], |
|
inputs=[text_input] |
|
) |
|
|
|
gr.Markdown(""" |
|
### Acknowledgments |
|
|
|
- [**Nasl-e-Mana**](https://naslemana.com/), the monthly magazine of the blind community of Iran |
|
- [ManaTTS Dataset](https://huggingface.co/datasets/MahtaFetrat/Mana-TTS) |
|
- [Persian-MultiSpeaker-Tacotron2](https://github.com/MahtaFetrat/Persian-MultiSpeaker-Tacotron2/) |
|
|
|
### Citation |
|
|
|
```bibtex |
|
@article{fetrat2024manatts, |
|
title={ManaTTS Persian: A Recipe for Creating TTS Datasets for Lower-Resource Languages}, |
|
author={Mahta Fetrat Qharabagh and Zahra Dehghanian and Hamid R. Rabiee}, |
|
journal={arXiv preprint arXiv:2409.07259}, |
|
year={2024}, |
|
} |
|
``` |
|
""") |
|
|
|
return demo |