File size: 2,789 Bytes
28d6785
5bcce08
28d6785
 
150d7c2
 
 
28d6785
 
3ec7c97
28d6785
 
 
 
30b857c
 
28d6785
30b857c
 
 
 
 
28d6785
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
087c3c2
28d6785
 
 
 
aeeb858
c31d772
28d6785
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5d57342
6bdadbb
 
 
 
 
 
 
 
 
 
28d6785
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import gradio as gr
from rvc import *

initial_md = """

# MIKU TTS - 5.0.1

"""

app = gr.Blocks(theme='NoCrypt/miku')
with app:
    gr.Markdown(initial_md)
    with gr.Row():
        with gr.Column():
            model_name = gr.Dropdown(label="Model",choices=models,value=models[0])
            f0_key_up = gr.Number(label="Tune",value=6)
        with gr.Column():
            f0_method = gr.Radio(label="Pitch extraction method (pm: very fast, low quality, rmvpe: a little slow, high quality)",choices=["pm", "rmvpe"], value="rmvpe",visible=False)       
            index_rate = gr.Slider(minimum=0,maximum=1,label="Index rate",value=1,interactive=True)
            protect0 = gr.Slider(minimum=0,maximum=0.5,label="Protect",value=0.33,step=0.01,interactive=True)
                                                          
            
    with gr.Row():
        with gr.Column():
            tts_voice = gr.Dropdown(
                label="Edge-tts speaker (format: language-Country-Name-Gender), make sure the gender matches the model",
                choices=tts_voices,
                allow_custom_value=False,
                value="ja-JP-NanamiNeural-Female",
            )
            speed = gr.Slider(
                minimum=-100,
                maximum=100,
                label="Speech speed (%)",
                value=0,
                step=10,
                interactive=True,
            )
            tts_text = gr.Textbox(label="Input Text", value="こんにちは、私の名前は初音ミクです!")
        with gr.Column():
            but0 = gr.Button("Convert", variant="primary")
            info_text = gr.Textbox(label="Output info")
        with gr.Column():
            with gr.Accordion("Edge Voice", visible=False):
                edge_tts_output = gr.Audio(label="Edge Voice", type="filepath")
            tts_output = gr.Audio(label="Result")
        but0.click(
            tts,
            [
                model_name,
                speed,
                tts_text,
                tts_voice,
                f0_key_up,
                f0_method,
                index_rate,
                protect0,
            ],
            [info_text, edge_tts_output, tts_output],
        )
    with gr.Row():
        examples = gr.Examples(
            examples_per_page=100,
            examples=[
                ["こんにちは、私の名前は初音ミクです!", "ja-JP-NanamiNeural-Female", 6],
                ["Hello there. My name is Hatsune Miku!","en-CA-ClaraNeural-Female", 6],
                ["Halo. Nama saya Hatsune Miku!","id-ID-GadisNeural-Female", 4],
                ["Halo. Jenengku Hatsune Miku!","jv-ID-SitiNeural-Female", 10],
            ],
            inputs=[tts_text, tts_voice, f0_key_up],
        )

app.launch()