Spaces:
Runtime error
Runtime error
vorstcavry
commited on
Commit
•
a4cc754
1
Parent(s):
0bb4fb8
Delete app.py
Browse files
app.py
DELETED
@@ -1,139 +0,0 @@
|
|
1 |
-
|
2 |
-
import os
|
3 |
-
from sys import executable
|
4 |
-
import subprocess
|
5 |
-
import pathlib
|
6 |
-
import gc
|
7 |
-
import time
|
8 |
-
import subprocess
|
9 |
-
def Gitclone(URI:str,ClonePath:pathlib.Path ) -> int :
|
10 |
-
if pathlib.Path.exists(ClonePath):
|
11 |
-
return 0
|
12 |
-
for z in range(10):
|
13 |
-
i=subprocess.run([r"git",r"clone",str(URI),str(ClonePath)])
|
14 |
-
if(i.returncode == 0 ):
|
15 |
-
del i
|
16 |
-
return 0
|
17 |
-
else :
|
18 |
-
del i
|
19 |
-
raise Exception(str.format("clone \'{0}\' failed",URI))
|
20 |
-
|
21 |
-
|
22 |
-
def DownLoad(URI:str,DownloadPath:pathlib.Path,DownLoadFileName:str ) -> int:
|
23 |
-
if (DownloadPath / DownLoadFileName).is_file(): return 0
|
24 |
-
for z in range(10):
|
25 |
-
i=subprocess.run([r"aria2c",r"-c",r"-x" ,r"16", r"-s",r"16", r"-k" ,r"1M" ,r"-m",r"0",r"--enable-mmap=false",r"--console-log-level=error",r"-d",str(DownloadPath),r"-o",DownLoadFileName,URI]);
|
26 |
-
if(i.returncode == 0 ):
|
27 |
-
del i
|
28 |
-
gc.collect()
|
29 |
-
return 0
|
30 |
-
else :
|
31 |
-
del i
|
32 |
-
raise Exception(str.format("download \'{0}\' failed",URI))
|
33 |
-
|
34 |
-
user_home =pathlib.Path.home().resolve()
|
35 |
-
os.chdir(str(user_home))
|
36 |
-
#clone stable-diffusion-webui repo
|
37 |
-
print("cloning stable-diffusion-webui repo")
|
38 |
-
Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",user_home / r"stable-diffusion-webui")
|
39 |
-
#os.chdir(str(user_home / r"stable-diffusion-webui"))
|
40 |
-
#os.system("git reset --hard "+commit_id)
|
41 |
-
|
42 |
-
os.chdir(user_home / r"stable-diffusion-webui")
|
43 |
-
#install extensions
|
44 |
-
print("installing extensions")
|
45 |
-
while (True):
|
46 |
-
i=subprocess.run([r"wget",r"https://raw.githubusercontent.com/camenduru/stable-diffusion-webui-scripts/main/run_n_times.py",r"-O",str(user_home / r"stable-diffusion-webui" / r"scripts" / r"run_n_times.py")])
|
47 |
-
if(i.returncode == 0 ):
|
48 |
-
del i
|
49 |
-
gc.collect()
|
50 |
-
break
|
51 |
-
else :
|
52 |
-
del i
|
53 |
-
#Gitclone(r"https://github.com/deforum-art/deforum-for-automatic1111-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"deforum-for-automatic1111-webui" )
|
54 |
-
#Gitclone(r"https://github.com/AlUlkesh/stable-diffusion-webui-images-browser",user_home / r"stable-diffusion-webui" / r"extensions"/ r"stable-diffusion-webui-images-browser")
|
55 |
-
Gitclone(r"https://github.com/camenduru/stable-diffusion-webui-huggingface",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-huggingface")
|
56 |
-
Gitclone(r"https://github.com/BlafKing/sd-civitai-browser-plus",user_home / r"stable-diffusion-webui" / r"extensions" / r"civitai-browser")
|
57 |
-
Gitclone(r"https://github.com/kohya-ss/sd-webui-additional-networks",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks")
|
58 |
-
Gitclone(r"https://github.com/Mikubill/sd-webui-controlnet",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-controlnet")
|
59 |
-
Gitclone(r"https://github.com/fkunn1326/openpose-editor",user_home / r"stable-diffusion-webui" / r"extensions" / r"openpose-editor")
|
60 |
-
#Gitclone(r"https://github.com/jexom/sd-webui-depth-lib",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-depth-lib")
|
61 |
-
#Gitclone(r"https://github.com/hnmr293/posex",user_home / r"stable-diffusion-webui" / r"extensions" / r"posex")
|
62 |
-
#Gitclone(r"https://github.com/nonnonstop/sd-webui-3d-open-pose-editor",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-3d-open-pose-editor")
|
63 |
-
#Gitclone(r"https://github.com/hnmr293/posex",user_home / r"stable-diffusion-webui" / r"extensions" / r"posex")
|
64 |
-
Gitclone(r"https://github.com/EdithForsaken/sd-webui-cloud-inference.git",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-cloud-inference")
|
65 |
-
Gitclone(r"https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git" , user_home / r"stable-diffusion-webui" / r"extensions" / r"a1111-sd-webui-tagcomplete")
|
66 |
-
Gitclone(r"https://github.com/camenduru/sd-webui-tunnels",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-tunnels")
|
67 |
-
Gitclone(r"https://github.com/etherealxx/batchlinks-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"batchlinks-webui")
|
68 |
-
Gitclone(r"https://github.com/zanllp/sd-webui-infinite-image-browsing",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-infinite-image-browsing")
|
69 |
-
#Gitclone(r"https://github.com/catppuccin/stable-diffusion-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-catppuccin")
|
70 |
-
#Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui-rembg",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-rembg")
|
71 |
-
Gitclone(r"https://tinyurl.com/aspect-ratio-v",user_home / r"stable-diffusion-webui" / r"extensions" / r"aspect-ratio")
|
72 |
-
#Gitclone(r"https://github.com/vorstcavry/cleaner",user_home / r"stable-diffusion-webui" / r"extensions" / r"cleaner")
|
73 |
-
Gitclone(r"https://github.com/hnmr293/sd-webui-llul",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-llul")
|
74 |
-
Gitclone(r"https://github.com/IDEA-Research/DWPose",user_home / r"stable-diffusion-webui" / r"extensions" / r"DWPose")
|
75 |
-
Gitclone(r"https://github.com/Bing-su/adetailer",user_home / r"stable-diffusion-webui" / r"extensions" / r"adetailer")
|
76 |
-
|
77 |
-
#Gitclone(r"https://github.com/NoCrypt/sd_hf_out",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_hf_out")
|
78 |
-
#Gitclone(r"https://github.com/Iyashinouta/sd-model-downloader",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-model-downloader")
|
79 |
-
#Gitclone(r"https://github.com/AIrjen/OneButtonPrompt",user_home / r"stable-diffusion-webui" / r"extensions" / r"OneButtonPrompt")
|
80 |
-
#Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui-wildcards",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-wildcards")
|
81 |
-
#Gitclone(r"https://github.com/adieyal/sd-dynamic-prompts",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-dynamic-prompts")
|
82 |
-
#Gitclone(r"https://github.com/d8ahazard/sd_dreambooth_extension",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd_dreambooth_extension")
|
83 |
-
#Gitclone(r"https://github.com/yfszzx/stable-diffusion-webui-inspiration",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-inspiration")
|
84 |
-
#Gitclone(r"https://github.com/Coyote-A/ultimate-upscale-for-automatic1111",user_home / r"stable-diffusion-webui" / r"extensions" / r"ultimate-upscale-for-automatic1111")
|
85 |
-
os.chdir(user_home / r"stable-diffusion-webui")
|
86 |
-
#download ControlNet models
|
87 |
-
print("extensions dolwnload done .\ndownloading ControlNet models")
|
88 |
-
dList =[ r"https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors",
|
89 |
-
r"https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_openpose_fp16.safetensors",
|
90 |
-
r"https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_lineart_fp16.safetensors",
|
91 |
-
r"https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors",
|
92 |
-
r"https://huggingface.co/comfyanonymous/ControlNet-v1-1_fp16_safetensors/resolve/main/control_v11p_sd15_canny_fp16.safetensors"]
|
93 |
-
for i in range(0,len(dList)): DownLoad(dList[i],user_home / r"stable-diffusion-webui" / r"models" / r"ControlNet",pathlib.Path(dList[i]).name)
|
94 |
-
del dList
|
95 |
-
|
96 |
-
print("ControlNet models download done.\ndownloading model")
|
97 |
-
#Stable Diffusion Checkpoint Model
|
98 |
-
|
99 |
-
DownLoad(r"https://huggingface.co/vorstcavry/mymodel/resolve/main/Cavry_V2.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion" / r"Checkpoint",r"Cavry_V2.safetensors")
|
100 |
-
#downloadvae
|
101 |
-
DownLoad(r"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"VAE",r"vae-ft-mse-840000-ema-pruned.safetensors")
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
#GFPGAN Model
|
106 |
-
#detection Resnet50
|
107 |
-
DownLoad(r"https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"detection_Resnet50_Final.pth")
|
108 |
-
#parsing_parsenet
|
109 |
-
DownLoad(r"https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"parsing_parsenet.pth")
|
110 |
-
#GFPGANv1.4
|
111 |
-
DownLoad(r"https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth",user_home / r"stable-diffusion-webui"/r"models"/r"GFPGAN",r"GFPGANv1.4.pth")
|
112 |
-
#strt Stable Diffusion Webui
|
113 |
-
print("Done\nStarting Webui...")
|
114 |
-
os.chdir(user_home / r"stable-diffusion-webui")
|
115 |
-
import subprocess
|
116 |
-
import pathlib
|
117 |
-
|
118 |
-
user_home = pathlib.Path("/home/user") # Gantilah dengan path yang sesuai
|
119 |
-
|
120 |
-
args = [
|
121 |
-
executable,
|
122 |
-
user_home / "stable-diffusion-webui" / "launch.py",
|
123 |
-
"--precision", "full",
|
124 |
-
"--no-half",
|
125 |
-
"--no-half-vae",
|
126 |
-
"--enable-insecure-extension-access",
|
127 |
-
"--medvram",
|
128 |
-
"--skip-torch-cuda-test",
|
129 |
-
"--enable-console-prompts",
|
130 |
-
"--ui-settings-file=" + str(pathlib.Path(__file__).parent / "config.json")
|
131 |
-
]
|
132 |
-
|
133 |
-
args = [arg.as_posix() if isinstance(arg, pathlib.PosixPath) else arg for arg in args]
|
134 |
-
|
135 |
-
try:
|
136 |
-
ret = subprocess.run(args)
|
137 |
-
except Exception as e:
|
138 |
-
print("Error:", e)
|
139 |
-
del os ,user_home ,pyexecutable ,subprocess
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|