File size: 1,171 Bytes
e1e9e3d
 
 
 
 
 
 
 
 
 
 
 
25e57fb
 
 
e1e9e3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
if os.environ.get("SPACES_ZERO_GPU") is not None:
    import spaces
else:
    class spaces:
        @staticmethod
        def GPU(func):
            def wrapper(*args, **kwargs):
                return func(*args, **kwargs)
            return wrapper
import sys
from pathlib import Path
from utils import set_token, git_clone, run, get_file
HF_TOKEN = os.environ.get("HF_TOKEN")
set_token(HF_TOKEN)

@spaces.GPU
def fake_gpu():
  pass

BASE_DIR = str(Path(__file__).resolve().parent.resolve())
WEBUI_DIR = str(Path(BASE_DIR, "stable-diffusion-webui").resolve())
#os.environ["PYTHONPATH"] = os.environ.get("PYTHONPATH") + f":{WEBUI_DIR}:."

git_clone("https://github.com/AUTOMATIC1111/stable-diffusion-webui.git", BASE_DIR)

os.chdir(WEBUI_DIR)
#sys.path.insert(0, WEBUI_DIR)
#run(f"python3 launch.py --precision full --no-half --no-half-vae --enable-insecure-extension-access --medvram --always-cpu --skip-torch-cuda-test --disable-gpu-warning --enable-console-prompts")
run(f"python3 launch.py --precision full --no-half --no-half-vae --enable-insecure-extension-access --medvram --skip-torch-cuda-test --enable-console-prompts")