import os os.chdir(f"/home/user/app") os.system(f"git clone -b v2.6 https://github.com/camenduru/stable-diffusion-webui /home/user/app/stable-diffusion-webui") os.chdir(f"/home/user/app/stable-diffusion-webui") os.chdir(f"/home/user/app/stable-diffusion-webui/extensions") os.system(f"git clone https://github.com/Mikubill/sd-webui-controlnet.git") 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' /home/user/app/stable-diffusion-webui/modules/ui.py") os.system(f"sed -i -e '253,258d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py") os.system(f"sed -i -e '186,228d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py") os.system(f"sed -i -e '171,178d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py") os.system(f"sed -i -e '108,113d' /home/user/app/stable-diffusion-webui/modules/ui_settings.py") os.system(f"sed -i -e '225,227d' /home/user/app/stable-diffusion-webui/modules/ui_loadsave.py") os.system(f"sed -i -e '214,217d' /home/user/app/stable-diffusion-webui/modules/ui_loadsave.py") os.system(f"rm -rfv /home/user/app/stable-diffusion-webui/scripts/") os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co./RSPMetaAdmin/Deliberate_V2/resolve/main/Deliberate_v2.safetensors -d /home/user/app/stable-diffusion-webui/models/Stable-diffusion -o Deliberate_v2.safetensors") os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co./SG161222/Realistic_Vision_V5.1_noVAE/resolve/main/Realistic_Vision_V5.1.safetensors -d /home/user/app/stable-diffusion-webui/models/Stable-diffusion -o Realistic_Vision_V5.1.safetensors") os.system(f"aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co./SG161222/Realistic_Vision_V5.1_noVAE/resolve/main/Realistic_Vision_V5.1.safetensors -d /home/user/app/stable-diffusion-webui/models/Stable-diffusion -o Realistic_Vision_V5.1.safetensors") # Cloning the sd-webui-controlnet extension # Installing required dependencies (if any) os.chdir(f"/home/user/app/stable-diffusion-webui/extensions/sd-webui-controlnet/models") os.system(f"wget https://huggingface.co./lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth.pth") os.system(f"wget https://huggingface.co./lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny.pth") os.system(f"wget https://huggingface.co./lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg.pth") os.system(f"wget https://huggingface.co./lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart.pth") # Check the extension's documentation for specific dependencies # Modifying configuration files (if necessary) # Refer to the extension's documentation for specific instructions # Launching the webui os.system(f"python launch.py --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")