Spaces:
Sleeping
Sleeping
Commit
·
716c66f
1
Parent(s):
8f4d804
Update app.py
Browse files
app.py
CHANGED
@@ -294,19 +294,17 @@ async def text_to_speech_edge(text, voice):
|
|
294 |
|
295 |
with gr.Blocks(title="ChatGLM2-6B-int4", theme=gr.themes.Soft(text_size="sm")) as demo:
|
296 |
gr.HTML("<center>"
|
297 |
-
"<h1>🥳💕🎶 - ChatGLM2 +
|
298 |
"</center>")
|
299 |
-
gr.Markdown("## <center
|
300 |
-
gr.Markdown("## <center>🌊 -
|
301 |
-
gr.Markdown("### <center>⭐ -
|
302 |
|
303 |
-
with gr.Accordion("📒
|
304 |
-
_ = f""" ChatGLM2
|
305 |
* Low temperature: responses will be more deterministic and focused; High temperature: responses more creative.
|
306 |
* Suggested temperatures -- translation: up to 0.3; chatting: > 0.4
|
307 |
-
* Top P controls dynamic vocabulary selection based on context
|
308 |
-
如果您想让ChatGLM2进行角色扮演并与之对话,请先输入恰当的提示词,如“请你扮演成动漫角色蜡笔小新并和我进行对话”;您也可以为ChatGLM2提供自定义的角色设定\n
|
309 |
-
当您使用声音克隆功能时,请先在此程序的对应位置上传一段您喜欢的音频
|
310 |
"""
|
311 |
gr.Markdown(dedent(_))
|
312 |
chatbot = gr.Chatbot(height=300)
|
@@ -314,19 +312,19 @@ with gr.Blocks(title="ChatGLM2-6B-int4", theme=gr.themes.Soft(text_size="sm")) a
|
|
314 |
with gr.Column(scale=4):
|
315 |
with gr.Column(scale=12):
|
316 |
user_input = gr.Textbox(
|
317 |
-
label="
|
318 |
-
placeholder="
|
319 |
)
|
320 |
RETRY_FLAG = gr.Checkbox(value=False, visible=False)
|
321 |
with gr.Column(min_width=32, scale=1):
|
322 |
with gr.Row():
|
323 |
-
submitBtn = gr.Button("
|
324 |
-
deleteBtn = gr.Button("
|
325 |
-
retryBtn = gr.Button("
|
326 |
|
327 |
-
with gr.Accordion("🔧
|
328 |
with gr.Row():
|
329 |
-
emptyBtn = gr.Button("
|
330 |
max_length = gr.Slider(
|
331 |
0,
|
332 |
32768,
|
@@ -344,20 +342,20 @@ with gr.Blocks(title="ChatGLM2-6B-int4", theme=gr.themes.Soft(text_size="sm")) a
|
|
344 |
|
345 |
|
346 |
with gr.Row():
|
347 |
-
test1 = gr.Textbox(label="
|
348 |
with gr.Column():
|
349 |
-
language = gr.Dropdown(choices=voices, value="en-US-AnaNeural-Female", label="
|
350 |
-
tts_btn = gr.Button("
|
351 |
-
output_audio = gr.Audio(type="filepath", label="
|
352 |
|
353 |
tts_btn.click(text_to_speech_edge, inputs=[test1, language], outputs=[output_audio])
|
354 |
|
355 |
with gr.Row():
|
356 |
model_choice = gr.Dropdown(choices=["FreeVC", "FreeVC-s", "FreeVC (24kHz)"], value="FreeVC (24kHz)", label="Model", visible=False)
|
357 |
audio1 = output_audio
|
358 |
-
audio2 = gr.Audio(label="
|
359 |
-
clone_btn = gr.Button("
|
360 |
-
audio_cloned = gr.Audio(label="
|
361 |
|
362 |
clone_btn.click(convert, inputs=[model_choice, audio1, audio2], outputs=[audio_cloned])
|
363 |
|
@@ -473,11 +471,11 @@ with gr.Blocks(title="ChatGLM2-6B-int4", theme=gr.themes.Soft(text_size="sm")) a
|
|
473 |
)
|
474 |
# """
|
475 |
|
476 |
-
gr.Markdown("### <center
|
477 |
-
gr.Markdown("<center>💡 -
|
478 |
gr.HTML('''
|
479 |
<div class="footer">
|
480 |
-
<p>🌊🏞️🎶 -
|
481 |
</p>
|
482 |
</div>
|
483 |
''')
|
|
|
294 |
|
295 |
with gr.Blocks(title="ChatGLM2-6B-int4", theme=gr.themes.Soft(text_size="sm")) as demo:
|
296 |
gr.HTML("<center>"
|
297 |
+
"<h1>🥳💕🎶 - ChatGLM2 + Voice Cloning</h1>"
|
298 |
"</center>")
|
299 |
+
gr.Markdown("## <center🥳 - Chat with any character you like through ChatGLM2-6B and voice cloning in real time</center>")
|
300 |
+
gr.Markdown("## <center>🌊 - Powered by [TalktalkAI](http://www.talktalkai.com)</center>")
|
301 |
+
gr.Markdown("### <center>⭐ - If you like the this app, please star my [Github repo](https://github.com/KevinWang676/ChatGLM2-Voice-Cloning).</center>")
|
302 |
|
303 |
+
with gr.Accordion("📒 Info", open=False):
|
304 |
+
_ = f""" Some parameters of ChatGLM2:
|
305 |
* Low temperature: responses will be more deterministic and focused; High temperature: responses more creative.
|
306 |
* Suggested temperatures -- translation: up to 0.3; chatting: > 0.4
|
307 |
+
* Top P controls dynamic vocabulary selection based on context.
|
|
|
|
|
308 |
"""
|
309 |
gr.Markdown(dedent(_))
|
310 |
chatbot = gr.Chatbot(height=300)
|
|
|
312 |
with gr.Column(scale=4):
|
313 |
with gr.Column(scale=12):
|
314 |
user_input = gr.Textbox(
|
315 |
+
label="Chat with ChatGLM2 here",
|
316 |
+
placeholder="Enter something here...",
|
317 |
)
|
318 |
RETRY_FLAG = gr.Checkbox(value=False, visible=False)
|
319 |
with gr.Column(min_width=32, scale=1):
|
320 |
with gr.Row():
|
321 |
+
submitBtn = gr.Button("Chat now!", variant="primary")
|
322 |
+
deleteBtn = gr.Button("Delete last turn", variant="secondary")
|
323 |
+
retryBtn = gr.Button("Regenerate", variant="secondary")
|
324 |
|
325 |
+
with gr.Accordion("🔧 Settings", open=False):
|
326 |
with gr.Row():
|
327 |
+
emptyBtn = gr.Button("Clear History")
|
328 |
max_length = gr.Slider(
|
329 |
0,
|
330 |
32768,
|
|
|
342 |
|
343 |
|
344 |
with gr.Row():
|
345 |
+
test1 = gr.Textbox(label="Response from ChatGLM2 (you can edit the content)", lines = 3)
|
346 |
with gr.Column():
|
347 |
+
language = gr.Dropdown(choices=voices, value="en-US-AnaNeural-Female", label="Please select a voice")
|
348 |
+
tts_btn = gr.Button("Generate", variant="primary")
|
349 |
+
output_audio = gr.Audio(type="filepath", label="Audio generated by Edge-TTS", interactive=False)
|
350 |
|
351 |
tts_btn.click(text_to_speech_edge, inputs=[test1, language], outputs=[output_audio])
|
352 |
|
353 |
with gr.Row():
|
354 |
model_choice = gr.Dropdown(choices=["FreeVC", "FreeVC-s", "FreeVC (24kHz)"], value="FreeVC (24kHz)", label="Model", visible=False)
|
355 |
audio1 = output_audio
|
356 |
+
audio2 = gr.Audio(label="Upload reference audio for voice cloning (~5s)", type='filepath')
|
357 |
+
clone_btn = gr.Button("Generate", variant="primary")
|
358 |
+
audio_cloned = gr.Audio(label="Generated audio in a custom voice", type='filepath')
|
359 |
|
360 |
clone_btn.click(convert, inputs=[model_choice, audio1, audio2], outputs=[audio_cloned])
|
361 |
|
|
|
471 |
)
|
472 |
# """
|
473 |
|
474 |
+
gr.Markdown("### <center>❗ Please do not generate content that could infringe upon the rights or cause harm to individuals or organizations.</center>")
|
475 |
+
gr.Markdown("<center>💡 - How to use this app:After sending your questions to ChatGLM2, click </center>")
|
476 |
gr.HTML('''
|
477 |
<div class="footer">
|
478 |
+
<p>🌊🏞️🎶 - Powered by talktalkai
|
479 |
</p>
|
480 |
</div>
|
481 |
''')
|