File size: 2,259 Bytes
299dee8
d847810
 
 
 
 
 
d3c027d
 
 
 
 
 
 
 
d847810
 
 
 
 
 
d3c027d
 
 
 
 
d847810
 
 
 
299dee8
e32a21b
 
 
 
 
 
d4a6d4e
 
 
 
 
 
 
 
d3c027d
 
 
 
 
 
 
 
 
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import os

# Initial clone
initial_repo_path = "/home/user/app/stable-diffusion-webui"
initial_repo_url = "https://github.com/camenduru/stable-diffusion-webui"
initial_branch = "v2.6"
os.chdir("/home/user/app")

# Check if the repository already exists
if not os.path.exists(initial_repo_path):
    os.system(f"git clone -b {initial_branch} {initial_repo_url} {initial_repo_path}")
else:
    # If the repository exists, update it
    os.chdir(initial_repo_path)
    os.system("git pull")

# Change directory to the cloned repository
os.chdir(initial_repo_path)

# Clone the Controlnet extension
controlnet_repo_url = "https://github.com/Mikubill/sd-webui-controlnet"
controlnet_repo_path = os.path.join(initial_repo_path, "controlnet")

# Check if the controlnet repository already exists
if not os.path.exists(controlnet_repo_path):
    os.system(f"git clone {controlnet_repo_url} {controlnet_repo_path}")

# Continue with the rest of your setup...
os.chdir(initial_repo_path)

os.system(f"git lfs install")

# Add the Controlnet setup
controlnet_script_path = os.path.join(controlnet_repo_path, "webui-user.bat")
os.system(f"call {controlnet_script_path} --opt-sdp-no-mem-attention --no-half-vae --opt-channelslast")


# os.system(f"git reset --hard")
# os.system(f"sed -i -e '/demo:/r /home/user/app/header_patch_v2.py' modules/ui.py")
# os.system(f"sed -i -e '253,258d' modules/ui_settings.py")
# os.system(f"sed -i -e '186,228d' modules/ui_settings.py")
# os.system(f"sed -i -e '171,178d' modules/ui_settings.py")
# os.system(f"sed -i -e '108,113d' modules/ui_settings.py")
# os.system(f"sed -i -e '225,227d' modules/ui_loadsave.py")
# os.system(f"sed -i -e '214,217d' modules/ui_loadsave.py")

# Create the 'scripts/' directory if it doesn't exist
os.makedirs("scripts", exist_ok=True)

# Download the necessary file
os.system("aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/counterfeit-xl/resolve/main/counterfeitxl_v10.safetensors -d models/Stable-diffusion -o counterfeitxl_v10.safetensors")

# Run the application
os.system("python launch.py --api --cors-allow-origins=* --theme dark --gradio-queue --ui-settings-file /home/user/app/shared-config_v2.json --ui-config-file /home/user/app/shared-ui-config_v2.json")