Spaces:
Runtime error
Runtime error
import os | |
from subprocess import getoutput | |
gpu_info = getoutput('nvidia-smi') | |
if("A10G" in gpu_info): | |
os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl") | |
elif("T4" in gpu_info): | |
os.system(f"pip install -q https://github.com/camenduru/stable-diffusion-webui-colab/releases/download/0.0.16/xformers-0.0.16+814314d.d20230118-cp38-cp38-linux_x86_64.whl") | |
os.system(f"git clone --depth 1 https://github.com/AUTOMATIC1111/stable-diffusion-webui /home/user/app/stable-diffusion-webui") | |
os.chdir("/home/user/app/stable-diffusion-webui") | |
#os.system(f"wget -q https://github.com/camenduru/webui/raw/main/env_patch.py -O /home/user/app/env_patch.py") | |
#os.system(f"sed -i -e '/import image_from_url_text/r /home/user/app/env_patch.py' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"sed -i -e '/(modelmerger_interface, \"Checkpoint Merger\", \"modelmerger\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"sed -i -e '/(train_interface, \"Train\", \"ti\"),/d' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"sed -i -e '/extensions_interface, \"Extensions\", \"extensions\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"sed -i -e '/settings_interface, \"Settings\", \"settings\"/d' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f'''sed -i -e "s/document.getElementsByTagName('gradio-app')\[0\].shadowRoot/!!document.getElementsByTagName('gradio-app')[0].shadowRoot ? document.getElementsByTagName('gradio-app')[0].shadowRoot : document/g" /home/user/app/stable-diffusion-webui/script.js''') | |
#os.system(f"sed -i -e 's/ show_progress=False,/ show_progress=True,/g' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"sed -i -e 's/shared.demo.launch/shared.demo.queue().launch/g' /home/user/app/stable-diffusion-webui/webui.py") | |
#os.system(f"sed -i -e 's/inputs=\[component\],/&\\n queue=False,/g' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"sed -i -e 's/outputs=\[token_counter\]/outputs=[token_counter], queue=False/g' /home/user/app/stable-diffusion-webui/modules/ui.py") | |
#os.system(f"wget -q https://gist.github.com/camenduru/9ec5f8141db9902e375967e93250860f/raw/d0bcf01786f20107c329c03f8968584ee67be12a/run_n_times.py -O /home/user/app/stable-diffusion-webui/scripts/run_n_times.py") | |
os.system(f"wget -q https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.ckpt -O /home/user/app/stable-diffusion-webui/models/VAE/vae-ft-mse-840000-ema-pruned.ckpt") | |
######### Extensions | |
#os.system(f"git clone --depth 1 https://github.com/camenduru/stable-diffusion-webui-artists-to-study /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-artists-to-study") | |
os.system(f"git clone --depth 1 https://github.com/butaixianran/Stable-Diffusion-Webui-Civitai-Helper /home/user/app/stable-diffusion-webui/extensions/Stable-Diffusion-Webui-Civitai-Helper") | |
os.system(f"git clone --depth 1 https://github.com/kohya-ss/sd-webui-additional-networks /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks") | |
#os.system(f"git clone --depth 1 https://github.com/yfszzx/stable-diffusion-webui-images-browser /home/user/app/stable-diffusion-webui/extensions/stable-diffusion-webui-images-browser") | |
######### Checkpoints | |
#os.system(f"wget -q https://civitai.com/api/download/models/5036 -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/abyssorangemix2Nsfw.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/11811 -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/abyssorangemix3A3.safetensors") | |
os.system(f"wget -q https://civitai.com/api/download/models/5038 -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/AbyssOrangeMix2Hardcore.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/20877 -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/AnyHentai.safetensors") | |
os.system(f"wget -q https://huggingface.co/andite/anything-v4.0/resolve/main/anything-v4.5-pruned.safetensors -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/Anything-v4.5-pruned.safetensors") | |
######### Loras | |
#os.makedirs(f"/home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/Lora") | |
#os.system(f"wget -q https://civitai.com/api/download/models/7033 -O /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/LorayukiyoshiMamizuStyle_1.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/15529 -O /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/StandingDoggystyle_v11a.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/6371 -O /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/lucyCyberpunk_35Epochs.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/22256 -O /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/SuspendedCongress.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/25727 -O /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/TiptoesStanding.safetensors") | |
#os.system(f"wget -q https://civitai.com/api/download/models/17638 -O /home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/xray-pregnancy.safetensors") | |
#os.rename(f"/home/user/app/lora-ts-01.safetensors", f"/home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/lora-ts-01.safetensors") | |
os.rename(f"/home/user/app/lora-ts-05.safetensors", f"/home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/lora-ts-05.safetensors") | |
#os.rename(f"/home/user/app/puuzaki-05.safetensors", f"/home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/puuzaki-05.safetensors") | |
os.rename(f"/home/user/app/puuzaki-15.safetensors", f"/home/user/app/stable-diffusion-webui/extensions/sd-webui-additional-networks/models/lora/puuzaki-15.safetensors") | |
#os.system(f"git clone --depth 1 https://github.com/deforum-art/deforum-for-automatic1111-webui /home/user/app/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui") | |
# Please duplicate this space and delete # character in front of the model you want to use or add here more ckpts with same structure os.system(f"wget -q https://CKPT_URL -O /home/user/app/stable-diffusion-webui/models/Stable-diffusion/CKPT_NAME.ckpt") | |
os.system(f"EXPOSE 7860") | |
os.system(f"python launch.py --precision full --no-half --use-cpu all --listen --ui-config-file /home/user/app/ui-config.json --ui-settings-file /home/user/app/config.json --cors-allow-origins huggingface.co,hf.space --no-progressbar-hiding --skip-torch-cuda-test") | |