From 969cc555291be53ec2da2e5fa610b9b037b98b07 Mon Sep 17 00:00:00 2001 From: sumof2primes Date: Mon, 13 Mar 2023 00:18:31 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A0=88=ED=8F=AC=EC=A7=80=ED=86=A0=EB=A6=AC?= =?UTF-8?q?=20=EA=B2=BD=EB=A1=9C=EB=A5=BC=20=ED=95=9C=EA=B3=B3=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=89=BD=EA=B2=8C=20=EB=B3=80=EA=B2=BD=ED=95=A0=20?= =?UTF-8?q?=EC=88=98=20=EC=9E=88=EB=8F=84=EB=A1=9D=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- easy-stable-diffusion.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/easy-stable-diffusion.py b/easy-stable-diffusion.py index cb4f06f..c1f28df 100644 --- a/easy-stable-diffusion.py +++ b/easy-stable-diffusion.py @@ -27,6 +27,7 @@ #@markdown ### ***작업 디렉터리 경로*** #@markdown 임베딩, 모델, 결과와 설정 파일 등이 영구적으로 보관될 디렉터리 경로 WORKSPACE = 'SD' #@param {type:"string"} +REPOSITORY = 'repository' #@markdown ##### ***자동으로 코랩 런타임을 종료할지?*** DISCONNECT_RUNTIME = True #@param {type:"boolean"} @@ -726,17 +727,17 @@ def parse_webui_output(line: str) -> None: def setup_webui() -> None: - repo_dir = Path('repository') + repository = Path(REPOSITORY) need_clone = True # 이미 디렉터리가 존재한다면 정상적인 레포인지 확인하기 - if repo_dir.is_dir(): + if repository.is_dir(): try: # 사용자 파일만 남겨두고 레포지토리 초기화하기 # https://stackoverflow.com/a/12096327 execute( 'git stash && git pull', - cwd=repo_dir + cwd=str(repository) ) except subprocess.CalledProcessError: log('레포지토리가 잘못됐습니다, 디렉터리를 제거합니다') @@ -745,18 +746,18 @@ def setup_webui() -> None: # 레포지토리 클론이 필요하다면 기존 디렉터리 지우고 클론하기 if need_clone: - shutil.rmtree(repo_dir, ignore_errors=True) - execute(['git', 'clone', OPTIONS['REPO_URL'], str(repo_dir)]) + shutil.rmtree(repository, ignore_errors=True) + execute(['git', 'clone', OPTIONS['REPO_URL'], str(repository)]) # 특정 커밋이 지정됐다면 체크아웃하기 if OPTIONS['REPO_COMMIT']: execute( ['git', 'checkout', OPTIONS['REPO_COMMIT']], - cwd=repo_dir + cwd=str(repository) ) if IN_COLAB: - patch_path = repo_dir.joinpath('scripts', 'patches.py') + patch_path = repository.joinpath('scripts', 'patches.py') if not patch_path.exists(): download( @@ -767,7 +768,7 @@ def setup_webui() -> None: def start_webui(args: List[str] = OPTIONS['ARGS']) -> None: workspace = Path(WORKSPACE).resolve() - repository = Path('repository').resolve() + repository = Path(REPOSITORY).resolve() # 기본 인자 만들기 if len(args) < 1: