mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Avoid unnecessary calls UI -> backend, to make it faster
This commit is contained in:
parent
1d79aa67cf
commit
386500aa37
@ -181,7 +181,7 @@ def create_event_handlers():
|
|||||||
chat.generate_chat_reply_wrapper, gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
chat.generate_chat_reply_wrapper, gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['textbox'].submit(
|
shared.gradio['textbox'].submit(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
@ -189,28 +189,28 @@ def create_event_handlers():
|
|||||||
chat.generate_chat_reply_wrapper, gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
chat.generate_chat_reply_wrapper, gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Regenerate'].click(
|
shared.gradio['Regenerate'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
partial(chat.generate_chat_reply_wrapper, regenerate=True), gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
partial(chat.generate_chat_reply_wrapper, regenerate=True), gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Continue'].click(
|
shared.gradio['Continue'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
partial(chat.generate_chat_reply_wrapper, _continue=True), gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
partial(chat.generate_chat_reply_wrapper, _continue=True), gradio(inputs), gradio('display', 'history'), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Impersonate'].click(
|
shared.gradio['Impersonate'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda x: x, gradio('textbox'), gradio('Chat input'), show_progress=False).then(
|
lambda x: x, gradio('textbox'), gradio('Chat input'), show_progress=False).then(
|
||||||
chat.impersonate_wrapper, gradio(inputs), gradio('textbox', 'display'), show_progress=False).then(
|
chat.impersonate_wrapper, gradio(inputs), gradio('textbox', 'display'), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Replace last reply'].click(
|
shared.gradio['Replace last reply'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
@ -288,7 +288,7 @@ def create_event_handlers():
|
|||||||
chat.redraw_html, gradio(reload_arr), gradio('display')).then(
|
chat.redraw_html, gradio(reload_arr), gradio('display')).then(
|
||||||
lambda x: gr.update(choices=(histories := chat.find_all_histories(x)), value=histories[0]), gradio('interface_state'), gradio('unique_id')).then(
|
lambda x: gr.update(choices=(histories := chat.find_all_histories(x)), value=histories[0]), gradio('interface_state'), gradio('unique_id')).then(
|
||||||
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
chat.save_history, gradio('history', 'unique_id', 'character_menu', 'mode'), None).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_chat()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_chat()}}')
|
||||||
|
|
||||||
shared.gradio['character_menu'].change(
|
shared.gradio['character_menu'].change(
|
||||||
chat.load_character, gradio('character_menu', 'name1', 'name2'), gradio('name1', 'name2', 'character_picture', 'greeting', 'context')).success(
|
chat.load_character, gradio('character_menu', 'name1', 'name2'), gradio('name1', 'name2', 'character_picture', 'greeting', 'context')).success(
|
||||||
@ -296,7 +296,7 @@ def create_event_handlers():
|
|||||||
chat.load_latest_history, gradio('interface_state'), gradio('history')).then(
|
chat.load_latest_history, gradio('interface_state'), gradio('history')).then(
|
||||||
chat.redraw_html, gradio(reload_arr), gradio('display')).then(
|
chat.redraw_html, gradio(reload_arr), gradio('display')).then(
|
||||||
lambda x: gr.update(choices=(histories := chat.find_all_histories(x)), value=histories[0]), gradio('interface_state'), gradio('unique_id')).then(
|
lambda x: gr.update(choices=(histories := chat.find_all_histories(x)), value=histories[0]), gradio('interface_state'), gradio('unique_id')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.update_big_picture_js}; updateBigPicture()}}')
|
None, None, None, js=f'() => {{{ui.update_big_picture_js}; updateBigPicture()}}')
|
||||||
|
|
||||||
shared.gradio['mode'].change(
|
shared.gradio['mode'].change(
|
||||||
lambda x: [gr.update(visible=x != 'instruct'), gr.update(visible=x == 'chat-instruct')], gradio('mode'), gradio('chat_style', 'chat-instruct_command'), show_progress=False).then(
|
lambda x: [gr.update(visible=x != 'instruct'), gr.update(visible=x == 'chat-instruct')], gradio('mode'), gradio('chat_style', 'chat-instruct_command'), show_progress=False).then(
|
||||||
@ -336,11 +336,11 @@ def create_event_handlers():
|
|||||||
|
|
||||||
shared.gradio['Submit character'].click(
|
shared.gradio['Submit character'].click(
|
||||||
chat.upload_character, gradio('upload_json', 'upload_img_bot'), gradio('character_menu')).then(
|
chat.upload_character, gradio('upload_json', 'upload_img_bot'), gradio('character_menu')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_character()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_character()}}')
|
||||||
|
|
||||||
shared.gradio['Submit tavern character'].click(
|
shared.gradio['Submit tavern character'].click(
|
||||||
chat.upload_tavern_character, gradio('upload_img_tavern', 'tavern_json'), gradio('character_menu')).then(
|
chat.upload_tavern_character, gradio('upload_img_tavern', 'tavern_json'), gradio('character_menu')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_character()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_character()}}')
|
||||||
|
|
||||||
shared.gradio['upload_json'].upload(lambda: gr.update(interactive=True), None, gradio('Submit character'))
|
shared.gradio['upload_json'].upload(lambda: gr.update(interactive=True), None, gradio('Submit character'))
|
||||||
shared.gradio['upload_json'].clear(lambda: gr.update(interactive=False), None, gradio('Submit character'))
|
shared.gradio['upload_json'].clear(lambda: gr.update(interactive=False), None, gradio('Submit character'))
|
||||||
@ -354,28 +354,28 @@ def create_event_handlers():
|
|||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda x: x.update({'mode': 'instruct', 'history': {'internal': [], 'visible': []}}), gradio('interface_state'), None).then(
|
lambda x: x.update({'mode': 'instruct', 'history': {'internal': [], 'visible': []}}), gradio('interface_state'), None).then(
|
||||||
partial(chat.generate_chat_prompt, 'Input'), gradio('interface_state'), gradio('textbox-default')).then(
|
partial(chat.generate_chat_prompt, 'Input'), gradio('interface_state'), gradio('textbox-default')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_default()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_default()}}')
|
||||||
|
|
||||||
shared.gradio['send_instruction_to_notebook'].click(
|
shared.gradio['send_instruction_to_notebook'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda x: x.update({'mode': 'instruct', 'history': {'internal': [], 'visible': []}}), gradio('interface_state'), None).then(
|
lambda x: x.update({'mode': 'instruct', 'history': {'internal': [], 'visible': []}}), gradio('interface_state'), None).then(
|
||||||
partial(chat.generate_chat_prompt, 'Input'), gradio('interface_state'), gradio('textbox-notebook')).then(
|
partial(chat.generate_chat_prompt, 'Input'), gradio('interface_state'), gradio('textbox-notebook')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_notebook()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_notebook()}}')
|
||||||
|
|
||||||
shared.gradio['send_instruction_to_negative_prompt'].click(
|
shared.gradio['send_instruction_to_negative_prompt'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda x: x.update({'mode': 'instruct', 'history': {'internal': [], 'visible': []}}), gradio('interface_state'), None).then(
|
lambda x: x.update({'mode': 'instruct', 'history': {'internal': [], 'visible': []}}), gradio('interface_state'), None).then(
|
||||||
partial(chat.generate_chat_prompt, 'Input'), gradio('interface_state'), gradio('negative_prompt')).then(
|
partial(chat.generate_chat_prompt, 'Input'), gradio('interface_state'), gradio('negative_prompt')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_generation_parameters()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_generation_parameters()}}')
|
||||||
|
|
||||||
shared.gradio['send-chat-to-default'].click(
|
shared.gradio['send-chat-to-default'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
partial(chat.generate_chat_prompt, '', _continue=True), gradio('interface_state'), gradio('textbox-default')).then(
|
partial(chat.generate_chat_prompt, '', _continue=True), gradio('interface_state'), gradio('textbox-default')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_default()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_default()}}')
|
||||||
|
|
||||||
shared.gradio['send-chat-to-notebook'].click(
|
shared.gradio['send-chat-to-notebook'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
partial(chat.generate_chat_prompt, '', _continue=True), gradio('interface_state'), gradio('textbox-notebook')).then(
|
partial(chat.generate_chat_prompt, '', _continue=True), gradio('interface_state'), gradio('textbox-notebook')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_notebook()}}')
|
None, None, None, js=f'() => {{{ui.switch_tabs_js}; switch_to_notebook()}}')
|
||||||
|
|
||||||
shared.gradio['show_controls'].change(lambda x: None, gradio('show_controls'), None, js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
|
shared.gradio['show_controls'].change(None, gradio('show_controls'), None, js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
|
||||||
|
@ -67,21 +67,21 @@ def create_event_handlers():
|
|||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['textbox-default'].submit(
|
shared.gradio['textbox-default'].submit(
|
||||||
lambda x: x, gradio('textbox-default'), gradio('last_input-default')).then(
|
lambda x: x, gradio('textbox-default'), gradio('last_input-default')).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['markdown_render-default'].click(lambda x: x, gradio('output_textbox'), gradio('markdown-default'), queue=False)
|
shared.gradio['markdown_render-default'].click(lambda x: x, gradio('output_textbox'), gradio('markdown-default'), queue=False)
|
||||||
shared.gradio['Continue-default'].click(
|
shared.gradio['Continue-default'].click(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
generate_reply_wrapper, [shared.gradio['output_textbox']] + gradio(inputs)[1:], gradio(outputs), show_progress=False).then(
|
generate_reply_wrapper, [shared.gradio['output_textbox']] + gradio(inputs)[1:], gradio(outputs), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Stop-default'].click(stop_everything_event, None, None, queue=False)
|
shared.gradio['Stop-default'].click(stop_everything_event, None, None, queue=False)
|
||||||
shared.gradio['prompt_menu-default'].change(load_prompt, gradio('prompt_menu-default'), gradio('textbox-default'), show_progress=False)
|
shared.gradio['prompt_menu-default'].change(load_prompt, gradio('prompt_menu-default'), gradio('textbox-default'), show_progress=False)
|
||||||
|
@ -67,14 +67,14 @@ def create_event_handlers():
|
|||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['textbox-notebook'].submit(
|
shared.gradio['textbox-notebook'].submit(
|
||||||
lambda x: x, gradio('textbox-notebook'), gradio('last_input-notebook')).then(
|
lambda x: x, gradio('textbox-notebook'), gradio('last_input-notebook')).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Undo'].click(lambda x: x, gradio('last_input-notebook'), gradio('textbox-notebook'), show_progress=False)
|
shared.gradio['Undo'].click(lambda x: x, gradio('last_input-notebook'), gradio('textbox-notebook'), show_progress=False)
|
||||||
shared.gradio['markdown_render-notebook'].click(lambda x: x, gradio('textbox-notebook'), gradio('markdown-notebook'), queue=False)
|
shared.gradio['markdown_render-notebook'].click(lambda x: x, gradio('textbox-notebook'), gradio('markdown-notebook'), queue=False)
|
||||||
@ -83,7 +83,7 @@ def create_event_handlers():
|
|||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
generate_reply_wrapper, gradio(inputs), gradio(outputs), show_progress=False).then(
|
||||||
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
ui.gather_interface_values, gradio(shared.input_elements), gradio('interface_state')).then(
|
||||||
lambda: None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
None, None, None, js=f'() => {{{ui.audio_notification_js}}}')
|
||||||
|
|
||||||
shared.gradio['Stop-notebook'].click(stop_everything_event, None, None, queue=False)
|
shared.gradio['Stop-notebook'].click(stop_everything_event, None, None, queue=False)
|
||||||
shared.gradio['prompt_menu-notebook'].change(load_prompt, gradio('prompt_menu-notebook'), gradio('textbox-notebook'), show_progress=False)
|
shared.gradio['prompt_menu-notebook'].change(load_prompt, gradio('prompt_menu-notebook'), gradio('textbox-notebook'), show_progress=False)
|
||||||
|
@ -32,10 +32,10 @@ def create_ui():
|
|||||||
# Reset interface event
|
# Reset interface event
|
||||||
shared.gradio['reset_interface'].click(
|
shared.gradio['reset_interface'].click(
|
||||||
set_interface_arguments, gradio('extensions_menu', 'bool_menu'), None).then(
|
set_interface_arguments, gradio('extensions_menu', 'bool_menu'), None).then(
|
||||||
lambda: None, None, None, js='() => {document.body.innerHTML=\'<h1 style="font-family:monospace;padding-top:20%;margin:0;height:100vh;color:lightgray;text-align:center;background:var(--body-background-fill)">Reloading...</h1>\'; setTimeout(function(){location.reload()},2500); return []}')
|
None, None, None, js='() => {document.body.innerHTML=\'<h1 style="font-family:monospace;padding-top:20%;margin:0;height:100vh;color:lightgray;text-align:center;background:var(--body-background-fill)">Reloading...</h1>\'; setTimeout(function(){location.reload()},2500); return []}')
|
||||||
|
|
||||||
shared.gradio['toggle_dark_mode'].click(
|
shared.gradio['toggle_dark_mode'].click(
|
||||||
lambda: None, None, None, js='() => {document.getElementsByTagName("body")[0].classList.toggle("dark")}').then(
|
None, None, None, js='() => {document.getElementsByTagName("body")[0].classList.toggle("dark")}').then(
|
||||||
lambda x: 'dark' if x == 'light' else 'light', gradio('theme_state'), gradio('theme_state'))
|
lambda x: 'dark' if x == 'light' else 'light', gradio('theme_state'), gradio('theme_state'))
|
||||||
|
|
||||||
shared.gradio['save_settings'].click(
|
shared.gradio['save_settings'].click(
|
||||||
|
@ -146,9 +146,9 @@ def create_interface():
|
|||||||
ui_model_menu.create_event_handlers()
|
ui_model_menu.create_event_handlers()
|
||||||
|
|
||||||
# Interface launch events
|
# Interface launch events
|
||||||
shared.gradio['interface'].load(lambda: None, None, None, js=f"() => {{if ({str(shared.settings['dark_theme']).lower()}) {{ document.getElementsByTagName('body')[0].classList.add('dark'); }} }}")
|
shared.gradio['interface'].load(None, None, None, js=f"() => {{if ({str(shared.settings['dark_theme']).lower()}) {{ document.getElementsByTagName('body')[0].classList.add('dark'); }} }}")
|
||||||
shared.gradio['interface'].load(lambda: None, None, None, js=f"() => {{{js}}}")
|
shared.gradio['interface'].load(None, None, None, js=f"() => {{{js}}}")
|
||||||
shared.gradio['interface'].load(lambda x: None, gradio('show_controls'), None, js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
|
shared.gradio['interface'].load(None, gradio('show_controls'), None, js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
|
||||||
shared.gradio['interface'].load(partial(ui.apply_interface_values, {}, use_persistent=True), None, gradio(ui.list_interface_input_elements()), show_progress=False)
|
shared.gradio['interface'].load(partial(ui.apply_interface_values, {}, use_persistent=True), None, gradio(ui.list_interface_input_elements()), show_progress=False)
|
||||||
shared.gradio['interface'].load(chat.redraw_html, gradio(ui_chat.reload_arr), gradio('display'))
|
shared.gradio['interface'].load(chat.redraw_html, gradio(ui_chat.reload_arr), gradio('display'))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user