File size: 2,153 Bytes
10e72d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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