Spaces:
Paused
Paused
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") | |
# 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") | |