Spaces:
Runtime error
Runtime error
Commit
·
ee02a02
1
Parent(s):
a8173be
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,21 +1,21 @@
|
|
| 1 |
-
#@title
|
| 2 |
-
|
|
|
|
| 3 |
import os
|
|
|
|
| 4 |
import subprocess
|
| 5 |
cek = subprocess.getoutput('nvidia-smi')
|
| 6 |
-
from google.colab.output import eval_js
|
| 7 |
-
os.environ['colab_url'] = eval_js("google.colab.kernel.proxyPort(7860, {'cache': false})")
|
| 8 |
-
|
| 9 |
if not 'T4' in cek:
|
| 10 |
-
print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----")
|
| 11 |
print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----")
|
| 12 |
raise KeyboardInterrupt
|
|
|
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
-
|
| 16 |
-
print('[1;
|
| 17 |
-
print('[
|
| 18 |
-
print('[0m')
|
| 19 |
%cd /content
|
| 20 |
#!if ! [ -f xformers ]; then 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; pip install -q --pre triton; touch xformers; fi
|
| 21 |
if not os.path.isfile('dependencies'):
|
|
@@ -45,26 +45,22 @@ if not os.path.isfile('dependencies'):
|
|
| 45 |
# !pip install -q --pre triton
|
| 46 |
!touch dependencies
|
| 47 |
|
| 48 |
-
print('[1;32mInstalling webui...')
|
| 49 |
-
print('[0m')
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
%cd stable-diffusion-webui
|
| 52 |
|
| 53 |
-
#AnythingV3 Model & Vae
|
| 54 |
-
print('[1;32mDownloading AnythingV3 model...')
|
| 55 |
-
print('[0m')
|
| 56 |
-
%cd /content/stable-diffusion-webui/models/Stable-diffusion/
|
| 57 |
-
!if ! [ -f Anything-V3.0.safetensors ]; then gdown https://huggingface.co/Linaqruf/anything-v3.0/resolve/main/anything-v3-fp32-pruned.safetensors -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors; fi
|
| 58 |
-
!if ! [ -f Anything-V3.0.vae.pt ]; then gdown https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt -O /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.vae.pt; fi
|
| 59 |
-
|
| 60 |
#webui setup for nai
|
| 61 |
-
print('[1;32mSetting UI configs...')
|
| 62 |
-
print('[0m')
|
| 63 |
%cd /content/stable-diffusion-webui
|
| 64 |
-
!if [ -f
|
| 65 |
-
!if ! [ -f
|
| 66 |
-
!
|
| 67 |
-
!touch configinstanlite
|
| 68 |
|
| 69 |
#notification bell
|
| 70 |
!gdown https://github.com/etherealxx/etherportal-webui-colab/raw/master/notification.mp3 -O /content/stable-diffusion-webui/notification.mp3
|
|
@@ -72,17 +68,17 @@ print('[0m')
|
|
| 72 |
#foolhardy remacri
|
| 73 |
! [ ! -d models/ESRGAN ] && mkdir -p models/ESRGAN; [ ! -f models/ESRGAN/4x_foolhardy_Remacri.pth ] && gdown https://huggingface.co/etherealxx/whoseisthis/resolve/main/4x_foolhardy_Remacri.pth -O /content/stable-diffusion-webui/models/ESRGAN/4x_foolhardy_Remacri.pth
|
| 74 |
|
|
|
|
|
|
|
| 75 |
#extensions
|
| 76 |
-
print('[1;32mInstalling extensions...')
|
| 77 |
-
print('[0m')
|
| 78 |
%cd /content/stable-diffusion-webui/extensions
|
| 79 |
-
!bash -c 'for repo in camenduru/stable-diffusion-webui-images-browser Extraltodeus/depthmap2mask
|
| 80 |
-
repo" && true; fi; done' #DominikDoom/a1111-sd-webui-tagcomplete
|
| 81 |
-
!bash -c 'for repo in sd-civitai-browser kohya-sd-scripts-webui stable-diffusion-webui-model-toolkit batchlinks-webui; do if [ -d "
|
| 82 |
-
repo && true; fi; done'
|
| 83 |
-
#%cd /content/stable-diffusion-webui/extensions/UnivAICharGen
|
| 84 |
-
#!git checkout c56b5146049b91cfcd645c62bd356bd0631c4131 .
|
| 85 |
!git clone -b pre-embedding --single-branch https://github.com/etherealxx/Umi-AI
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
#badprompt & badartist
|
| 88 |
%cd /content/stable-diffusion-webui/embeddings/
|
|
@@ -90,12 +86,5 @@ repo && true; fi; done'
|
|
| 90 |
!if ! [ -f bad_artist.pt ]; then gdown https://huggingface.co/etherealxx/whoseisthis/resolve/main/bad_artist.pt -O /content/stable-diffusion-webui/embeddings/bad_artist.pt; fi
|
| 91 |
!if ! [ -f bad_hands.pt ]; then gdown https://huggingface.co/etherealxx/whoseisthis/resolve/main/bad-hands-5.pt -O /content/stable-diffusion-webui/embeddings/bad_hands.pt; fi
|
| 92 |
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
!sed -i -e 's/fastapi==0.90.1/fastapi==0.89.1/g' /content/stable-diffusion-webui/requirements_versions.txt
|
| 96 |
-
|
| 97 |
-
print('[1;32mInstallation Success!')
|
| 98 |
-
print('[1;32mLaunching the webui...')
|
| 99 |
-
print('[0m')
|
| 100 |
-
%cd /content/stable-diffusion-webui
|
| 101 |
-
!python launch.py --ckpt /content/stable-diffusion-webui/models/Stable-diffusion/Anything-V3.0.safetensors --vae-path /content/stable-diffusion-webui
|
|
|
|
| 1 |
+
#@title 1. Installation
|
| 2 |
+
webui_version = "camenduru's fork (stable)" #@param ["camenduru's fork (stable)", "original automatic1111 repo (latest feature, might be buggy)"]
|
| 3 |
+
import shutil
|
| 4 |
import os
|
| 5 |
+
import requests
|
| 6 |
import subprocess
|
| 7 |
cek = subprocess.getoutput('nvidia-smi')
|
|
|
|
|
|
|
|
|
|
| 8 |
if not 'T4' in cek:
|
| 9 |
+
print("[1;32m-----Your colab session is over. Use other google account or wait 12-24 hours-----")
|
| 10 |
print("-----Sesi colab elu udah habis bro. Saran gw tunggu 12-24 jam atau bikin/pake akun google lain-----")
|
| 11 |
raise KeyboardInterrupt
|
| 12 |
+
from google.colab.output import eval_js
|
| 13 |
+
os.environ['colab_url'] = eval_js("google.colab.kernel.proxyPort(7860, {'cache': false})")
|
| 14 |
|
| 15 |
|
| 16 |
+
print('[1;32mInstalling dependencies...')
|
| 17 |
+
print('[1;32m(This process will only happen once per session)')
|
| 18 |
+
print('[0m')
|
|
|
|
| 19 |
%cd /content
|
| 20 |
#!if ! [ -f xformers ]; then 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; pip install -q --pre triton; touch xformers; fi
|
| 21 |
if not os.path.isfile('dependencies'):
|
|
|
|
| 45 |
# !pip install -q --pre triton
|
| 46 |
!touch dependencies
|
| 47 |
|
| 48 |
+
print('[1;32mInstalling webui...')
|
| 49 |
+
print('[0m')
|
| 50 |
+
if webui_version=="camenduru's fork (stable)":
|
| 51 |
+
!if ! [ -f forkedwebui ]; then echo "cloning from camenduru's fork"; rm -rf stable-diffusion-webui; git clone -b v2.1 https://github.com/camenduru/stable-diffusion-webui; sed -i -e '''/ prepare_environment()/a\ os.system\(f\"""sed -i -e ''\"s/dict()))/dict())).cuda()/g\"'' /content/stable-diffusion-webui/repositories/stable-diffusion-stability-ai/ldm/util.py""")''' /content/stable-diffusion-webui/launch.py; sed -i -e 's/fastapi==0.90.1/fastapi==0.89.1/g' /content/stable-diffusion-webui/requirements_versions.txt; touch forkedwebui; fi
|
| 52 |
+
else:
|
| 53 |
+
!if [ -f forkedwebui ]; then rm forkedwebui; mv '/content/stable-diffusion-webui/models/Stable-diffusion' '/content/temp'; rm -rf stable-diffusion-webui; fi
|
| 54 |
+
!if ! [ -d stable-diffusion-webui ]; then echo "cloning from official repo"; git clone https://github.com/automatic1111/stable-diffusion-webui; cp -rf '/content/temp'/* '/content/stable-diffusion-webui/models/Stable-diffusion'; rm -rf '/content/temp'; fi
|
| 55 |
%cd stable-diffusion-webui
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
#webui setup for nai
|
| 58 |
+
print('[1;32mSetting UI configs...')
|
| 59 |
+
print('[0m')
|
| 60 |
%cd /content/stable-diffusion-webui
|
| 61 |
+
!if [ -f configinstanlite ]; then rm configinstanlite && rm /content/stable-diffusion-webui/modules/ui.py && mv /content/stable-diffusion-webui/modules/ui_backup.py /content/stable-diffusion-webui/modules/ui.py; fi
|
| 62 |
+
!if ! [ -f configinstan ]; then gdown https://pastebin.com/raw/gMTvTUUZ -O /content/stable-diffusion-webui/ui-config.json && gdown https://pastebin.com/raw/VviKmfiQ -O /content/stable-diffusion-webui/config.json; fi
|
| 63 |
+
!touch configinstan
|
|
|
|
| 64 |
|
| 65 |
#notification bell
|
| 66 |
!gdown https://github.com/etherealxx/etherportal-webui-colab/raw/master/notification.mp3 -O /content/stable-diffusion-webui/notification.mp3
|
|
|
|
| 68 |
#foolhardy remacri
|
| 69 |
! [ ! -d models/ESRGAN ] && mkdir -p models/ESRGAN; [ ! -f models/ESRGAN/4x_foolhardy_Remacri.pth ] && gdown https://huggingface.co/etherealxx/whoseisthis/resolve/main/4x_foolhardy_Remacri.pth -O /content/stable-diffusion-webui/models/ESRGAN/4x_foolhardy_Remacri.pth
|
| 70 |
|
| 71 |
+
#temporaryfix
|
| 72 |
+
|
| 73 |
#extensions
|
| 74 |
+
print('[1;32mInstalling extensions...')
|
| 75 |
+
print('[0m')
|
| 76 |
%cd /content/stable-diffusion-webui/extensions
|
| 77 |
+
!bash -c 'for repo in camenduru/stable-diffusion-webui-images-browser camenduru/sd-civitai-browser Extraltodeus/depthmap2mask kohya-ss/sd-webui-additional-networks etherealxx/batchlinks-webui; do if [ ! -d "$repo" ]; then git clone "https://github.com/$repo" && true; fi; done' #DominikDoom/a1111-sd-webui-tagcomplete
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
!git clone -b pre-embedding --single-branch https://github.com/etherealxx/Umi-AI
|
| 79 |
+
#%cd /content/stable-diffusion-webui/extensions/UnivAICharGen
|
| 80 |
+
#!if [ -f forkedwebui ]; then git checkout c56b5146049b91cfcd645c62bd356bd0631c4131 .; fi
|
| 81 |
+
# !git clone -b lora --single-branch https://github.com/etherealxx/sd-civitai-browser
|
| 82 |
|
| 83 |
#badprompt & badartist
|
| 84 |
%cd /content/stable-diffusion-webui/embeddings/
|
|
|
|
| 86 |
!if ! [ -f bad_artist.pt ]; then gdown https://huggingface.co/etherealxx/whoseisthis/resolve/main/bad_artist.pt -O /content/stable-diffusion-webui/embeddings/bad_artist.pt; fi
|
| 87 |
!if ! [ -f bad_hands.pt ]; then gdown https://huggingface.co/etherealxx/whoseisthis/resolve/main/bad-hands-5.pt -O /content/stable-diffusion-webui/embeddings/bad_hands.pt; fi
|
| 88 |
|
| 89 |
+
print('[1;32mInstallation Success!')
|
| 90 |
+
print('[0m')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|