Spaces:
Sleeping
Sleeping
Update ui_client.py
Browse files- ui_client.py +17 -8
ui_client.py
CHANGED
|
@@ -108,10 +108,18 @@ def clear_fn(state):
|
|
| 108 |
if DELETE_FILE_WHEN_DO_CLEAR:
|
| 109 |
shutil.rmtree('output', ignore_errors=True)
|
| 110 |
state = {'session_id': pipeline.init_session()}
|
| 111 |
-
return [gr.Textbox.update(value=''),
|
| 112 |
-
gr.
|
| 113 |
-
|
| 114 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
|
| 117 |
def textbox_listener(textbox_input):
|
|
@@ -428,8 +436,6 @@ with gr.Blocks(css=css) as interface:
|
|
| 428 |
audio_output = gr.Video(elem_id="output-video")
|
| 429 |
|
| 430 |
generate_audio_btn = gr.Button(value='Generate Audio', interactive=False)
|
| 431 |
-
|
| 432 |
-
clear_btn = gr.ClearButton(value='Clear All')
|
| 433 |
|
| 434 |
# share to community
|
| 435 |
with gr.Group(elem_id="share-btn-container", visible=False):
|
|
@@ -463,6 +469,9 @@ with gr.Blocks(css=css) as interface:
|
|
| 463 |
interactive=True)
|
| 464 |
vp_submit = gr.Button(label='Upload Voice Preset', value="Upload Voice Preset")
|
| 465 |
|
|
|
|
|
|
|
|
|
|
| 466 |
# disclaimer
|
| 467 |
gr.Markdown(
|
| 468 |
"""
|
|
@@ -502,7 +511,7 @@ with gr.Blocks(css=css) as interface:
|
|
| 502 |
]
|
| 503 |
)
|
| 504 |
clear_btn.click(fn=clear_fn, inputs=ui_state,
|
| 505 |
-
outputs=[text_input, audio_output, audio_script_markdown, generate_audio_btn, generate_script_btn,
|
| 506 |
ui_state, voice_presets_df, del_voice_btn,
|
| 507 |
vp_text_id, vp_text_desc, vp_file])
|
| 508 |
generate_script_btn.click(
|
|
@@ -548,4 +557,4 @@ with gr.Blocks(css=css) as interface:
|
|
| 548 |
# print_state_btn = gr.Button(value='Print State')
|
| 549 |
# print_state_btn.click(fn=lambda state, state2: print(state, state2), inputs=[ui_state, selected_voice_presets])
|
| 550 |
interface.queue(concurrency_count=5)
|
| 551 |
-
interface.launch()
|
|
|
|
| 108 |
if DELETE_FILE_WHEN_DO_CLEAR:
|
| 109 |
shutil.rmtree('output', ignore_errors=True)
|
| 110 |
state = {'session_id': pipeline.init_session()}
|
| 111 |
+
return [gr.Textbox.update(value=''),
|
| 112 |
+
gr.Textbox.update(value=''),
|
| 113 |
+
gr.Markdown.update(value=''),
|
| 114 |
+
gr.Video.update(value=None),
|
| 115 |
+
gr.Markdown.update(value=''),
|
| 116 |
+
gr.Button.update(interactive=False),
|
| 117 |
+
gr.Button.update(interactive=False),
|
| 118 |
+
state, gr.Dataframe.update(visible=False),
|
| 119 |
+
gr.Button.update(visible=False),
|
| 120 |
+
gr.Textbox.update(value=''),
|
| 121 |
+
gr.Textbox.update(value=''),
|
| 122 |
+
gr.File.update(value=None)]
|
| 123 |
|
| 124 |
|
| 125 |
def textbox_listener(textbox_input):
|
|
|
|
| 436 |
audio_output = gr.Video(elem_id="output-video")
|
| 437 |
|
| 438 |
generate_audio_btn = gr.Button(value='Generate Audio', interactive=False)
|
|
|
|
|
|
|
| 439 |
|
| 440 |
# share to community
|
| 441 |
with gr.Group(elem_id="share-btn-container", visible=False):
|
|
|
|
| 469 |
interactive=True)
|
| 470 |
vp_submit = gr.Button(label='Upload Voice Preset', value="Upload Voice Preset")
|
| 471 |
|
| 472 |
+
# clear btn, will re-new a session
|
| 473 |
+
clear_btn = gr.ClearButton(value='Clear All')
|
| 474 |
+
|
| 475 |
# disclaimer
|
| 476 |
gr.Markdown(
|
| 477 |
"""
|
|
|
|
| 511 |
]
|
| 512 |
)
|
| 513 |
clear_btn.click(fn=clear_fn, inputs=ui_state,
|
| 514 |
+
outputs=[key_text_input, char_voice_map_markdown, text_input, audio_output, audio_script_markdown, generate_audio_btn, generate_script_btn,
|
| 515 |
ui_state, voice_presets_df, del_voice_btn,
|
| 516 |
vp_text_id, vp_text_desc, vp_file])
|
| 517 |
generate_script_btn.click(
|
|
|
|
| 557 |
# print_state_btn = gr.Button(value='Print State')
|
| 558 |
# print_state_btn.click(fn=lambda state, state2: print(state, state2), inputs=[ui_state, selected_voice_presets])
|
| 559 |
interface.queue(concurrency_count=5)
|
| 560 |
+
interface.launch()
|