Skip to content

Commit

Permalink
add exception handler in case preload breaks?
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Seiji Hariki <[email protected]>
  • Loading branch information
seijihariki committed Jan 24, 2023
1 parent 4ebdc9a commit 20a3397
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion preload.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

def preload(parser: argparse.ArgumentParser):
parser.add_argument("--lock-oo-submodule", action='store_true',
help="(openOutpaint-webUI-extension) Prevent checking for main openOutpaint submodule updates.")
help="(openOutpaint-webUI-extension) Prevent checking for main openOutpaint submodule updates.")

20 changes: 15 additions & 5 deletions scripts/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def started(demo, app: FastAPI):

# Add to allowed files list
app.blocks.temp_file_sets.append(force_allow)

# Force allow paths for fixing symlinked extension directory references (base javascript files now)
force_allow = get_files(extension_dir / "javascript")

Expand All @@ -49,11 +49,21 @@ def started(demo, app: FastAPI):
pass


def update_app():
git = os.environ.get('GIT', "git")
run(f'"{git}" -C "' + scripts.basedir() +
'" submodule update --init --recursive --remote')


def add_tab():
if (not shared.cmd_opts.lock_oo_submodule):
git = os.environ.get('GIT', "git")
run(f'"{git}" -C "' + scripts.basedir() +
'" submodule update --init --recursive --remote')
try:
if shared.cmd_opts.lock_oo_submodule:
print(f"[openOutpaint] Submodule locked. Will skip submodule update.")
else:
update_app()
except Exception:
update_app()

with gr.Blocks(analytics_enabled=False) as ui:
#refresh = gr.Button(value="refresh", variant="primary")
canvas = gr.HTML(
Expand Down

0 comments on commit 20a3397

Please sign in to comment.