mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-12-06 02:30:30 -08:00
gradio and FastAPI
This commit is contained in:
parent
1df3ff25e6
commit
8d5d863a9d
2 changed files with 16 additions and 15 deletions
18
webui.py
18
webui.py
|
|
@ -4,7 +4,7 @@ import time
|
|||
import importlib
|
||||
import signal
|
||||
import threading
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.gzip import GZipMiddleware
|
||||
|
||||
from modules.paths import script_path
|
||||
|
|
@ -31,7 +31,6 @@ from modules.paths import script_path
|
|||
from modules.shared import cmd_opts
|
||||
import modules.hypernetworks.hypernetwork
|
||||
|
||||
|
||||
queue_lock = threading.Lock()
|
||||
|
||||
|
||||
|
|
@ -97,7 +96,7 @@ def initialize():
|
|||
|
||||
def create_api(app):
|
||||
from modules.api.api import Api
|
||||
api = Api(app)
|
||||
api = Api(app, queue_lock)
|
||||
return api
|
||||
|
||||
def wait_on_server(demo=None):
|
||||
|
|
@ -141,7 +140,7 @@ def webui(launch_api=False):
|
|||
create_api(app)
|
||||
|
||||
wait_on_server(demo)
|
||||
|
||||
|
||||
sd_samplers.set_samplers()
|
||||
|
||||
print('Reloading Custom Scripts')
|
||||
|
|
@ -153,11 +152,10 @@ def webui(launch_api=False):
|
|||
print('Restarting Gradio')
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not cmd_opts.nowebui:
|
||||
api_only()
|
||||
|
||||
if cmd_opts.api:
|
||||
webui(True)
|
||||
task = []
|
||||
if __name__ == "__main__":
|
||||
if cmd_opts.nowebui:
|
||||
api_only()
|
||||
else:
|
||||
webui(False)
|
||||
webui(cmd_opts.api)
|
||||
Loading…
Add table
Add a link
Reference in a new issue