Bump gradio to 4.19 (#5522)

This commit is contained in:
oobabooga 2024-03-05 07:32:28 -03:00 committed by GitHub
parent 164ff2440d
commit 63a1d4afc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 67 additions and 63 deletions

View file

@ -18,6 +18,7 @@ warnings.filterwarnings('ignore', category=UserWarning, message='The value passe
warnings.filterwarnings('ignore', category=UserWarning, message='Field "model_names" has conflict')
with RequestBlocker():
from modules import gradio_hijack
import gradio as gr
import matplotlib
@ -145,11 +146,9 @@ def create_interface():
ui_model_menu.create_event_handlers()
# Interface launch events
if shared.settings['dark_theme']:
shared.gradio['interface'].load(lambda: None, None, None, _js="() => document.getElementsByTagName('body')[0].classList.add('dark')")
shared.gradio['interface'].load(lambda: None, None, None, _js=f"() => {{{js}}}")
shared.gradio['interface'].load(None, gradio('show_controls'), None, _js=f'(x) => {{{ui.show_controls_js}; toggle_controls(x)}}')
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(lambda: 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(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'))
@ -157,9 +156,10 @@ def create_interface():
extensions_module.create_extensions_block() # Extensions block
# Launch the interface
shared.gradio['interface'].queue(concurrency_count=64)
shared.gradio['interface'].queue()
with OpenMonkeyPatch():
shared.gradio['interface'].launch(
max_threads=64,
prevent_thread_lock=True,
share=shared.args.share,
server_name=None if not shared.args.listen else (shared.args.listen_host or '0.0.0.0'),
@ -168,7 +168,8 @@ def create_interface():
auth=auth or None,
ssl_verify=False if (shared.args.ssl_keyfile or shared.args.ssl_certfile) else True,
ssl_keyfile=shared.args.ssl_keyfile,
ssl_certfile=shared.args.ssl_certfile
ssl_certfile=shared.args.ssl_certfile,
allowed_paths=["."]
)