updatr gradio

This commit is contained in:
Vladimir Mandic
2023-05-22 08:42:47 -04:00
parent d647bb5c05
commit e129e83276
6 changed files with 20 additions and 20 deletions
+2 -3
View File
@@ -521,9 +521,8 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='jpg', i
if path is None: # set default path to avoid errors when functions are triggered manually or via api and param is not set
path = shared.opts.outdir_save
namegen = FilenameGenerator(p, seed, prompt, image)
if save_to_dirs is None:
save_to_dirs = (grid and shared.opts.grid_save_to_dirs) or (not grid and shared.opts.save_to_dirs and not no_prompt)
else:
save_to_dirs = save_to_dirs or (grid and shared.opts.grid_save_to_dirs) or (not grid and shared.opts.save_to_dirs and not no_prompt)
if save_to_dirs:
dirname = namegen.apply(shared.opts.directories_filename_pattern or "[prompt_words]").lstrip(' ').rstrip('\\ /')
path = os.path.join(path, dirname)
os.makedirs(path, exist_ok=True)
+1
View File
@@ -16,6 +16,7 @@ import modules.errors as errors
errors.install()
def setup_middleware(app: FastAPI, cmd_opts):
log.info('Initializing middleware')
ssl._create_default_https_context = ssl._create_unverified_context # pylint: disable=protected-access
+1 -1
View File
@@ -51,7 +51,7 @@ accelerate==0.18.0
opencv-python==4.7.0.72
diffusers==0.16.1
einops==0.4.1
gradio==3.31.0
gradio==3.32.0
numexpr==2.8.4
numpy==1.24.3
numba==0.57.0
+14 -14
View File
@@ -180,18 +180,6 @@ def create_api(app):
return api
def monkey_patch_docs():
def setup_with_docs(self):
self.docs_url = "/docs"
self.redoc_url = "/redoc"
self.setup_original()
setup_original = getattr(FastAPI, "setup_original", None)
if setup_original is None:
FastAPI.setup_original = FastAPI.setup
setattr(FastAPI, "setup", setup_with_docs)
def async_policy():
_BasePolicy = asyncio.WindowsSelectorEventLoopPolicy if sys.platform == "win32" and hasattr(asyncio, "WindowsSelectorEventLoopPolicy") else asyncio.DefaultEventLoopPolicy
@@ -225,7 +213,6 @@ def start_ui():
modules.script_callbacks.before_ui_callback()
startup_timer.record("scripts before_ui_callback")
shared.demo = modules.ui.create_ui()
monkey_patch_docs()
startup_timer.record("ui")
if cmd_opts.disable_queue:
log.info('Server queues disabled')
@@ -241,6 +228,7 @@ def start_ui():
for line in file.readlines():
gradio_auth_creds += [x.strip() for x in line.split(',') if x.strip()]
import installer
app, local_url, share_url = shared.demo.launch(
share=cmd_opts.share,
server_name=server_name,
@@ -255,6 +243,18 @@ def start_ui():
max_threads=64,
show_api=True,
favicon_path='html/logo.ico',
app_kwargs={
"version": f'0.0.{installer.git_commit}',
"title": "SD.Next",
"description": "SD.Next",
"docs_url": "/docs",
"redocs_url": "/redocs",
"swagger_ui_parameters": {
"displayOperationId": True,
"showCommonExtensions": True,
"deepLinking": False,
},
}
)
shared.log.info(f'Local URL: {local_url}')
shared.log.info(f'API Docs: {local_url[:-1]}/docs') # {local_url[:-1]}?view=api
@@ -271,7 +271,7 @@ def start_ui():
shared.log.info('Redirector mounted: /{cmd_opts.subpath}')
cmd_opts.autolaunch = False
startup_timer.record("start")
startup_timer.record("launch")
modules.progress.setup_progress_api(app)
create_api(app)