Spaces:
Paused
Paused
terug gezet app.py
Browse files
app.py
CHANGED
|
@@ -1,54 +1,17 @@
|
|
| 1 |
import os
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
initial_repo_url = "https://github.com/camenduru/stable-diffusion-webui"
|
| 6 |
-
initial_branch = "v2.6"
|
| 7 |
-
os.chdir("/home/user/app")
|
| 8 |
-
|
| 9 |
-
# Check if the repository already exists
|
| 10 |
-
if not os.path.exists(initial_repo_path):
|
| 11 |
-
os.system(f"git clone -b {initial_branch} {initial_repo_url} {initial_repo_path}")
|
| 12 |
-
else:
|
| 13 |
-
# If the repository exists, update it
|
| 14 |
-
os.chdir(initial_repo_path)
|
| 15 |
-
os.system("git pull")
|
| 16 |
-
|
| 17 |
-
# Change directory to the cloned repository
|
| 18 |
-
os.chdir(initial_repo_path)
|
| 19 |
-
|
| 20 |
-
# Clone the Controlnet extension
|
| 21 |
-
controlnet_repo_url = "https://github.com/Mikubill/sd-webui-controlnet"
|
| 22 |
-
controlnet_repo_path = os.path.join(initial_repo_path, "controlnet")
|
| 23 |
-
|
| 24 |
-
# Check if the controlnet repository already exists
|
| 25 |
-
if not os.path.exists(controlnet_repo_path):
|
| 26 |
-
os.system(f"git clone {controlnet_repo_url} {controlnet_repo_path}")
|
| 27 |
-
|
| 28 |
-
# Continue with the rest of your setup...
|
| 29 |
-
os.chdir(initial_repo_path)
|
| 30 |
-
|
| 31 |
os.system(f"git lfs install")
|
| 32 |
-
|
| 33 |
-
# Add the Controlnet setup
|
| 34 |
-
controlnet_script_path = os.path.join(controlnet_repo_path, "webui-user.bat")
|
| 35 |
-
os.system(f"call {controlnet_script_path} --opt-sdp-no-mem-attention --no-half-vae --opt-channelslast")
|
| 36 |
-
|
| 37 |
-
|
| 38 |
os.system(f"git reset --hard")
|
| 39 |
-
os.system(f"sed -i -e '/demo:/r /home/user/app/header_patch_v2.py' modules/ui.py")
|
| 40 |
-
os.system(f"sed -i -e '253,258d' modules/ui_settings.py")
|
| 41 |
-
os.system(f"sed -i -e '186,228d' modules/ui_settings.py")
|
| 42 |
-
os.system(f"sed -i -e '171,178d' modules/ui_settings.py")
|
| 43 |
-
os.system(f"sed -i -e '108,113d' modules/ui_settings.py")
|
| 44 |
-
os.system(f"sed -i -e '225,227d' modules/ui_loadsave.py")
|
| 45 |
-
os.system(f"sed -i -e '214,217d' modules/ui_loadsave.py")
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
os.
|
| 49 |
-
|
| 50 |
-
# Download the necessary file
|
| 51 |
-
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")
|
| 52 |
-
|
| 53 |
-
# Run the application
|
| 54 |
-
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")
|
|
|
|
| 1 |
import os
|
| 2 |
+
os.chdir(f"/home/user/app")
|
| 3 |
+
os.system(f"git clone -b v2.6 https://github.com/camenduru/stable-diffusion-webui /home/user/app/stable-diffusion-webui")
|
| 4 |
+
os.chdir(f"/home/user/app/stable-diffusion-webui")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
os.system(f"git lfs install")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
os.system(f"git reset --hard")
|
| 7 |
+
os.system(f"sed -i -e '/demo:/r /home/user/app/header_patch_v2.py' /home/user/app/stable-diffusion-webui/modules/ui.py")
|
| 8 |
+
os.system(f"sed -i -e '253,258d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py")
|
| 9 |
+
os.system(f"sed -i -e '186,228d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py")
|
| 10 |
+
os.system(f"sed -i -e '171,178d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py")
|
| 11 |
+
os.system(f"sed -i -e '108,113d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py")
|
| 12 |
+
os.system(f"sed -i -e '225,227d' /home/user/app/stable-diffusion-webui/modules/ui_loadsave.py")
|
| 13 |
+
os.system(f"sed -i -e '214,217d' /home/user/app/stable-diffusion-webui/modules/ui_loadsave.py")
|
| 14 |
+
os.system(f"rm -rfv /home/user/app/stable-diffusion-webui/scripts/")
|
| 15 |
+
os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/ckpt/counterfeit-xl/resolve/main/counterfeitxl_v10.safetensors -d /home/user/app/stable-diffusion-webui/models/Stable-diffusion -o counterfeitxl_v10.safetensors")
|
| 16 |
+
# os.system(f"python launch.py --api --cors-allow-origins=* --xformers --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")
|
| 17 |
+
os.system(f"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")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|