File size: 4,587 Bytes
85d3b29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import sys

sys.path.append("..")
import os

now_dir = os.getcwd()
from rvc.train.process_ckpt import (
    extract_small_model,
)

from rvc.lib.process.model_fusion import model_fusion
from rvc.lib.process.model_information import (
    model_information,
)

from assets.i18n.i18n import I18nAuto

i18n = I18nAuto()

import gradio as gr


def processing():
    with gr.Accordion(label=i18n("Model fusion (On progress)"), open=False):
        with gr.Column():
            model_fusion_name = gr.Textbox(
                label=i18n("Model Name"),
                value="",
                max_lines=1,
                interactive=True,
                placeholder=i18n("Enter model name"),
            )
            model_fusion_a = gr.Textbox(
                label=i18n("Path to Model A"),
                value="",
                interactive=True,
                placeholder=i18n("Path to model"),
            )
            model_fusion_b = gr.Textbox(
                label=i18n("Path to Model B"),
                value="",
                interactive=True,
                placeholder=i18n("Path to model"),
            )
        model_fusion_output_info = gr.Textbox(
            label=i18n("Output Information"),
            value="",
        )

        model_fusion_button = gr.Button(
            i18n("Fusion"), variant="primary", interactive=False
        )

        model_fusion_button.click(
            model_fusion,
            [
                model_fusion_name,
                model_fusion_a,
                model_fusion_b,
            ],
            model_fusion_output_info,
            api_name="model_fusion",
        )

    with gr.Accordion(label=i18n("View model information")):
        with gr.Row():
            with gr.Column():
                model_view_model_path = gr.Textbox(
                    label=i18n("Path to Model"),
                    value="",
                    interactive=True,
                    placeholder=i18n("Path to model"),
                )

        model_view_output_info = gr.Textbox(
            label=i18n("Output Information"), value="", max_lines=8
        )
        model_view_button = gr.Button(i18n("View"), variant="primary")
        model_view_button.click(
            model_information,
            [model_view_model_path],
            model_view_output_info,
            api_name="model_info",
        )

    with gr.Accordion(label=i18n("Model extraction")):
        with gr.Row():
            with gr.Column():
                model_extract_name = gr.Textbox(
                    label=i18n("Model Name"),
                    value="",
                    interactive=True,
                    placeholder=i18n("Enter model name"),
                )
                model_extract_path = gr.Textbox(
                    label=i18n("Path to Model"),
                    placeholder=i18n("Path to model"),
                    interactive=True,
                )
                model_extract_info = gr.Textbox(
                    label=i18n("Model information to be placed"),
                    value="",
                    max_lines=8,
                    interactive=True,
                    placeholder=i18n("Model information to be placed"),
                )
            with gr.Column():
                model_extract_pitch_guidance = gr.Checkbox(
                    label=i18n("Pitch Guidance"),
                    value=True,
                    interactive=True,
                )
                model_extract_rvc_version = gr.Radio(
                    label=i18n("RVC Version"),
                    choices=["v1", "v2"],
                    value="v2",
                    interactive=True,
                )
                model_extract_sampling_rate = gr.Radio(
                    label=i18n("Sampling Rate"),
                    choices=["32000", "40000", "48000"],
                    value="40000",
                    interactive=True,
                )
        model_extract_output_info = gr.Textbox(
            label=i18n("Output Information"), value="", max_lines=8
        )

        model_extract_button = gr.Button(i18n("Extract"), variant="primary")
        model_extract_button.click(
            extract_small_model,
            [
                model_extract_path,
                model_extract_name,
                model_extract_sampling_rate,
                model_extract_pitch_guidance,
                model_extract_info,
                model_extract_rvc_version,
            ],
            model_extract_output_info,
            api_name="model_extract",
        )