Upload reforge_launcher.py
Browse files1234567891011121314151617181920212223242526272829303132333435363738import subprocessimport sysimport timeimport os
def run_webui(): user_args = sys.argv[1:] python_exe = "/content/venv/GUTRIS1/bin/python3.10" command = [python_exe, "launch.py"] + user_args
attempt = 1 while True: print(f"\n๐ [{attempt}ํ์ฐจ] WebUI ์คํ ์๋...") # stdout=None์ผ๋ก ์ค์ ํ๋ฉด ์์คํ
์ด ์ง์ ๋ก๊ทธ๋ฅผ ์ฐ์ผ๋ฏ๋ก ์๋ ์ ํ๊ฐ 0์
๋๋ค. process = subprocess.Popen( command, env=os.environ.copy(), cwd="/content/stable-diffusion-webui-reForge" )
# ํ๋ก์ธ์ค๊ฐ ๋๋ ๋๊น์ง ๊ธฐ๋ค๋ฆฝ๋๋ค. return_code = process.wait()
# ๋ง์ฝ ์๋ฌ ์ฝ๋๋ฅผ ๋จ๊ธฐ๊ณ ์ฃฝ์๋ค๋ฉด (๋ณดํต 1) ์๋์ผ๋ก ์ฌ์์ if return_code != 0: print(f"\nโ ์๋ฌ ๋ฐ์ (Exit Code: {return_code}). 2์ด ํ ์๋ ์ฌ์์ํฉ๋๋ค...") attempt += 1 time.sleep(2) continue else: # ์ ์ ์ข
๋ฃ(0)์ธ ๊ฒฝ์ฐ ๋ฃจํ ํ์ถ print("\nโ
WebUI ์ข
๋ฃ.") break
if __name__ == "__main__": run_webui()
reforge_launcher.pyAdded+38