remove unwanted changes from #8789
This commit is contained in:
parent
f96e6fbd0c
commit
a95dc02535
@ -94,7 +94,6 @@ callback_map = dict(
|
||||
callbacks_script_unloaded=[],
|
||||
callbacks_before_ui=[],
|
||||
callbacks_on_reload=[],
|
||||
callbacks_on_polling=[],
|
||||
)
|
||||
|
||||
|
||||
@ -102,6 +101,7 @@ def clear_callbacks():
|
||||
for callback_list in callback_map.values():
|
||||
callback_list.clear()
|
||||
|
||||
|
||||
def app_started_callback(demo: Optional[Blocks], app: FastAPI):
|
||||
for c in callback_map['callbacks_app_started']:
|
||||
try:
|
||||
@ -109,14 +109,8 @@ def app_started_callback(demo: Optional[Blocks], app: FastAPI):
|
||||
except Exception:
|
||||
report_exception(c, 'app_started_callback')
|
||||
|
||||
def app_polling_callback(demo: Optional[Blocks], app: FastAPI):
|
||||
for c in callback_map['callbacks_on_polling']:
|
||||
try:
|
||||
c.callback()
|
||||
except Exception:
|
||||
report_exception(c, 'callbacks_on_polling')
|
||||
|
||||
def app_reload_callback(demo: Optional[Blocks], app: FastAPI):
|
||||
def app_reload_callback():
|
||||
for c in callback_map['callbacks_on_reload']:
|
||||
try:
|
||||
c.callback()
|
||||
@ -269,14 +263,11 @@ def on_app_started(callback):
|
||||
add_callback(callback_map['callbacks_app_started'], callback)
|
||||
|
||||
|
||||
def on_polling(callback):
|
||||
"""register a function to be called on each polling of the server."""
|
||||
add_callback(callback_map['callbacks_on_polling'], callback)
|
||||
|
||||
def on_before_reload(callback):
|
||||
"""register a function to be called just before the server reloads."""
|
||||
add_callback(callback_map['callbacks_on_reload'], callback)
|
||||
|
||||
|
||||
def on_model_loaded(callback):
|
||||
"""register a function to be called when the stable diffusion model is created; the model is
|
||||
passed as an argument; this function is also called when the script is reloaded. """
|
||||
|
4
webui.py
4
webui.py
@ -264,13 +264,13 @@ def create_api(app):
|
||||
def wait_on_server(demo=None):
|
||||
while 1:
|
||||
time.sleep(0.5)
|
||||
modules.script_callbacks.app_polling_callback(None, demo)
|
||||
if shared.state.need_restart:
|
||||
modules.script_callbacks.app_reload_callback(None, demo)
|
||||
shared.state.need_restart = False
|
||||
time.sleep(0.5)
|
||||
demo.close()
|
||||
time.sleep(0.5)
|
||||
|
||||
modules.script_callbacks.app_reload_callback()
|
||||
break
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user