diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-11-28 09:00:10 +0300 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-11-28 09:00:10 +0300 |
commit | 0b5dcb3d7ce397ad38312dbfc70febe7bb42dcc3 (patch) | |
tree | 8b1a9ed781eca8462b935365a0b4be23793b9e1b /webui.py | |
parent | 0376da180c81a11880a2587903d69d85541051e7 (diff) |
fix an error that happens when you type into prompt while switching model, put queue stuff into separate file
Diffstat (limited to 'webui.py')
-rw-r--r-- | webui.py | 30 |
1 files changed, 3 insertions, 27 deletions
@@ -8,6 +8,7 @@ from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware
from fastapi.middleware.gzip import GZipMiddleware
+from modules.call_queue import wrap_queued_call, queue_lock, wrap_gradio_gpu_call
from modules.paths import script_path
from modules import shared, devices, sd_samplers, upscaler, extensions, localization, ui_tempdir
@@ -32,38 +33,12 @@ from modules.shared import cmd_opts import modules.hypernetworks.hypernetwork
-queue_lock = threading.Lock()
if cmd_opts.server_name:
server_name = cmd_opts.server_name
else:
server_name = "0.0.0.0" if cmd_opts.listen else None
-def wrap_queued_call(func):
- def f(*args, **kwargs):
- with queue_lock:
- res = func(*args, **kwargs)
-
- return res
-
- return f
-
-
-def wrap_gradio_gpu_call(func, extra_outputs=None):
- def f(*args, **kwargs):
-
- shared.state.begin()
-
- with queue_lock:
- res = func(*args, **kwargs)
-
- shared.state.end()
-
- return res
-
- return modules.ui.wrap_gradio_call(f, extra_outputs=extra_outputs, add_stats=True)
-
-
def initialize():
extensions.list_extensions()
localization.list_localizations(cmd_opts.localizations_dir)
@@ -159,7 +134,7 @@ def webui(): if shared.opts.clean_temp_dir_at_start:
ui_tempdir.cleanup_tmpdr()
- shared.demo = modules.ui.create_ui(wrap_gradio_gpu_call=wrap_gradio_gpu_call)
+ shared.demo = modules.ui.create_ui()
app, local_url, share_url = shared.demo.launch(
share=cmd_opts.share,
@@ -189,6 +164,7 @@ def webui(): create_api(app)
modules.script_callbacks.app_started_callback(shared.demo, app)
+ modules.script_callbacks.app_started_callback(shared.demo, app)
wait_on_server(shared.demo)
|