correct webpath when webui_dir is not work_dir

This commit is contained in:
w-e-w
2023-09-13 16:05:55 +09:00
parent 6fb2194d9c
commit 5b761b49ad
3 changed files with 5 additions and 4 deletions

View File

@@ -2,12 +2,12 @@ import os
import gradio as gr
from modules import localization, shared, scripts
from modules.paths import script_path, data_path
from modules.paths import script_path, data_path, cwd
def webpath(fn):
if fn.startswith(script_path):
web_path = os.path.relpath(fn, script_path).replace('\\', '/')
if fn.startswith(cwd):
web_path = os.path.relpath(fn, cwd)
else:
web_path = os.path.abspath(fn)