| import os, sys, time, shlex, subprocess | |
| from IPython import get_ipython | |
| from pathlib import Path | |
| xxx = Path("/kaggle/working") | |
| zzz = Path("/kaggle/working/asd") | |
| tmp = Path("/kaggle/temp") | |
| pantat = f"curl -sLo {xxx}/pantat88.py https://raw.githubusercontent.com/gutris1/segsmaker/main/kaggle/script/pantat88.py" | |
| get_ipython().system(pantat) | |
| sys.path.append(str(xxx)) | |
| from pantat88 import pull, say, download | |
| def nenen(): | |
| os.chdir(zzz) | |
| say("【 {red} Installing Stable Diffusion {d} 】 {red}") | |
| time.sleep(2) | |
| pull(f"https://github.com/gutris1/segsmaker asd {zzz}") | |
| req_list = [ | |
| f"https://huggingface.co/pantat88/ui/resolve/main/embeddings.zip {zzz}", | |
| f"https://huggingface.co/pantat88/ui/resolve/main/4x-UltraSharp.pth {zzz}/models/ESRGAN", | |
| f"https://huggingface.co/pantat88/ui/resolve/main/4x-AnimeSharp.pth {zzz}/models/ESRGAN", | |
| f"https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth {zzz}/models/ESRGAN", | |
| f"https://huggingface.co/pantat88/ui/resolve/main/4x_RealisticRescaler_100000_G.pth {zzz}/models/ESRGAN", | |
| f"https://huggingface.co/pantat88/ui/resolve/main/8x_RealESRGAN.pth {zzz}/models/ESRGAN", | |
| f"https://huggingface.co/pantat88/ui/resolve/main/4x_foolhardy_Remacri.pth {zzz}/models/ESRGAN", | |
| f"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors {zzz}/models/VAE"] | |
| for lines in req_list: | |
| download(lines) | |
| unzip = f"unzip -qo {zzz}/embeddings.zip -d {zzz}/embeddings && rm {zzz}/embeddings.zip" | |
| get_ipython().system(unzip) | |
| cmd = [ | |
| f"rm -rf {tmp}/* {zzz}/models/Stable-diffusion/tmp_ckpt {zzz}/models/Lora/tmp_lora {zzz}/outputs", | |
| f"mkdir -p {zzz}/models/Lora", | |
| f"ln -vs {tmp}/ckpt {zzz}/models/Stable-diffusion/tmp_ckpt", | |
| f"ln -vs {tmp}/lora {zzz}/models/Lora/tmp_lora", | |
| f"ln -vs {tmp}/outputs {zzz}/outputs", | |
| f"mkdir -p {tmp}/ckpt {tmp}/lora {tmp}/outputs {tmp}/svd {tmp}/z123"] | |
| for lines in cmd: | |
| subprocess.run(shlex.split(lines), stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) | |
| nenen() | |
| (xxx / 'nenen88.py').unlink() | |
| get_ipython().run_line_magic('run', f'{xxx}/pantat88.py') | |
| os.chdir(xxx) |