Update app.py
Browse files
app.py
CHANGED
@@ -58,54 +58,52 @@ def generate_audio(text, temperature, top_P, top_K, audio_seed_input, text_seed_
|
|
58 |
return [(sample_rate, audio_data), text_data]
|
59 |
|
60 |
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
generate_text_seed = gr.Button("\U0001F3B2")
|
83 |
-
|
84 |
-
generate_button = gr.Button("Generate")
|
85 |
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
|
106 |
# demo.launch(server_name=args.server_name, server_port=args.server_port, inbrowser=True)
|
107 |
-
|
|
|
108 |
|
109 |
|
110 |
if __name__ == '__main__':
|
111 |
-
|
|
|
58 |
return [(sample_rate, audio_data), text_data]
|
59 |
|
60 |
|
61 |
+
with gr.Blocks() as demo:
|
62 |
+
gr.LoginButton()
|
63 |
+
gr.Markdown("# ChatTTS Webui")
|
64 |
+
gr.Markdown("ChatTTS Model: [2noise/ChatTTS](https://github.com/2noise/ChatTTS)")
|
65 |
+
|
66 |
+
default_text = "四川美食确实以辣闻名,但也有不辣的选择。比如甜水面、赖汤圆、蛋烘糕、叶儿粑等,这些小吃口味温和,甜而不腻,也很受欢迎。"
|
67 |
+
text_input = gr.Textbox(label="Input Text", lines=4, placeholder="Please Input Text...", value=default_text)
|
68 |
+
|
69 |
+
with gr.Row():
|
70 |
+
refine_text_checkbox = gr.Checkbox(label="Refine text", value=True)
|
71 |
+
temperature_slider = gr.Slider(minimum=0.00001, maximum=1.0, step=0.00001, value=0.3, label="Audio temperature")
|
72 |
+
top_p_slider = gr.Slider(minimum=0.1, maximum=0.9, step=0.05, value=0.7, label="top_P")
|
73 |
+
top_k_slider = gr.Slider(minimum=1, maximum=20, step=1, value=20, label="top_K")
|
74 |
+
|
75 |
+
with gr.Row():
|
76 |
+
audio_seed_input = gr.Number(value=42, label="Audio Seed")
|
77 |
+
generate_audio_seed = gr.Button("\U0001F3B2")
|
78 |
+
text_seed_input = gr.Number(value=42, label="Text Seed")
|
79 |
+
generate_text_seed = gr.Button("\U0001F3B2")
|
80 |
+
|
81 |
+
generate_button = gr.Button("Generate")
|
|
|
|
|
|
|
82 |
|
83 |
+
text_output = gr.Textbox(label="Output Text", interactive=False)
|
84 |
+
audio_output = gr.Audio(label="Output Audio")
|
85 |
|
86 |
+
generate_audio_seed.click(generate_seed,
|
87 |
+
inputs=[],
|
88 |
+
outputs=audio_seed_input)
|
89 |
|
90 |
+
generate_text_seed.click(generate_seed,
|
91 |
+
inputs=[],
|
92 |
+
outputs=text_seed_input)
|
93 |
|
94 |
+
generate_button.click(generate_audio,
|
95 |
+
inputs=[text_input, temperature_slider, top_p_slider, top_k_slider, audio_seed_input, text_seed_input, refine_text_checkbox],
|
96 |
+
outputs=[audio_output, text_output])
|
97 |
|
98 |
+
parser = argparse.ArgumentParser(description='ChatTTS demo Launch')
|
99 |
+
parser.add_argument('--server_name', type=str, default='0.0.0.0', help='Server name')
|
100 |
+
parser.add_argument('--server_port', type=int, default=8080, help='Server port')
|
101 |
+
args = parser.parse_args()
|
102 |
|
103 |
# demo.launch(server_name=args.server_name, server_port=args.server_port, inbrowser=True)
|
104 |
+
|
105 |
+
|
106 |
|
107 |
|
108 |
if __name__ == '__main__':
|
109 |
+
demo.launch()
|