r0seyyyd33p commited on
Commit
43589c6
1 Parent(s): 0fc5bfa

Upload 4 files

Browse files
Files changed (4) hide show
  1. app.py +119 -0
  2. config.json +9 -0
  3. packages.txt +2 -0
  4. requirements.txt +34 -0
app.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Stable Diffusion Webui Version 1.6
3
+ https://github.com/AUTOMATIC1111/stable-diffusion-webui/releases/tag/v1.6.0
4
+
5
+ """
6
+ commit_id=r"5ef669de080814067961f28357256e8fe27544f4" #Version 1.3.0
7
+ import os
8
+ from sys import executable
9
+ import subprocess
10
+ import pathlib
11
+ import gc
12
+
13
+ def Gitclone(URI:str,ClonePath:pathlib.Path ) -> int :
14
+ if pathlib.Path.exists(ClonePath):
15
+ return 0
16
+ for z in range(10):
17
+ i=subprocess.run([r"git",r"clone",str(URI),str(ClonePath)])
18
+ if(i.returncode == 0 ):
19
+ del i
20
+ return 0
21
+ else :
22
+ del i
23
+ raise Exception(str.format("clone \'{0}\' failed",URI))
24
+
25
+
26
+ def DownLoad(URI:str,DownloadPath:pathlib.Path,DownLoadFileName:str ) -> int:
27
+ if (DownloadPath / DownLoadFileName).is_file(): return 0
28
+ for z in range(10):
29
+ 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]);
30
+ if(i.returncode == 0 ):
31
+ del i
32
+ gc.collect()
33
+ return 0
34
+ else :
35
+ del i
36
+ raise Exception(str.format("download \'{0}\' failed",URI))
37
+
38
+ user_home =pathlib.Path.home().resolve()
39
+ os.chdir(str(user_home))
40
+ #clone stable-diffusion-webui repo
41
+ print("cloning stable-diffusion-webui repo")
42
+ Gitclone(r"https://github.com/AUTOMATIC1111/stable-diffusion-webui.git",user_home / r"stable-diffusion-webui")
43
+ os.chdir(str(user_home / r"stable-diffusion-webui"))
44
+ os.system("git reset --hard "+commit_id)
45
+ #install extensions
46
+ print("installing extensions")
47
+ Gitclone(r"https://huggingface.co/embed/negative",user_home / r"stable-diffusion-webui" / r"embeddings" / r"negative")
48
+ Gitclone(r"https://huggingface.co/embed/lora",user_home / r"stable-diffusion-webui" / r"models" / r"Lora" / r"positive")
49
+ DownLoad(r"https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth",user_home / r"stable-diffusion-webui" / r"models" / r"ESRGAN" ,r"4x-UltraSharp.pth")
50
+ while (True):
51
+ 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")])
52
+ if(i.returncode == 0 ):
53
+ del i
54
+ gc.collect()
55
+ break
56
+ else :
57
+ del i
58
+ Gitclone(r"https://github.com/deforum-art/deforum-for-automatic1111-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"deforum-for-automatic1111-webui" )
59
+ 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")
60
+ Gitclone(r"https://github.com/camenduru/stable-diffusion-webui-huggingface",user_home / r"stable-diffusion-webui" / r"extensions" / r"stable-diffusion-webui-huggingface")
61
+ Gitclone(r"https://github.com/BlafKing/sd-civitai-browser-plus",user_home / r"stable-diffusion-webui" / r"extensions" / r"civitai-browser")
62
+ Gitclone(r"https://github.com/kohya-ss/sd-webui-additional-networks",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks")
63
+ Gitclone(r"https://github.com/Bing-su/adetailer",user_home / r"stable-diffusion-webui" / r"extensions" / r"adetailer")
64
+ Gitclone(r"https://github.com/nolanaatama/microsoftexcel-controlnet",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-controlnet")
65
+ Gitclone(r"https://github.com/jexom/sd-webui-depth-lib",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-depth-lib")
66
+ Gitclone(r"https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git" , user_home / r"stable-diffusion-webui" / r"extensions" / r"a1111-sd-webui-tagcomplete")
67
+ Gitclone(r"https://github.com/camenduru/sd-webui-tunnels",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-tunnels")
68
+ Gitclone(r"https://github.com/etherealxx/batchlinks-webui",user_home / r"stable-diffusion-webui" / r"extensions" / r"batchlinks-webui")
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://tinyurl.com/aspect-ratio-v",user_home / r"stable-diffusion-webui" / r"extensions" / r"aspect-ratio")
71
+ os.chdir(user_home / r"stable-diffusion-webui")
72
+ #download ControlNet models
73
+ print("extensions dolwnload done .\ndownloading ControlNet models")
74
+ dList =[r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors",
75
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors",
76
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors",
77
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors",
78
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors",
79
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors",
80
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors",
81
+ r"https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile_fp16.safetensors"]
82
+ for i in range(0,len(dList)): DownLoad(dList[i],user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-controlnet" / r"models",pathlib.Path(dList[i]).name)
83
+ del dList
84
+ #download model
85
+ #you can change model download address here
86
+ print("ControlNet models download done.\ndownloading model")
87
+ #Stable Diffusion Checkpoint Model
88
+ #MeinaPastelV5
89
+ DownLoad(r"https://huggingface.co/Meina/MeinaPastel/resolve/main/MeinaPastelV5%20-%20Baked%20VAE.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"MeinaPastelV5_BakedVAE.safetensors")
90
+ #Photon
91
+ DownLoad(r"https://huggingface.co/nolanaatama/phtn/resolve/main/phtn.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"phtn.safetensors")
92
+ #RV
93
+ DownLoad(r"https://huggingface.co/SG161222/Realistic_Vision_V5.1_noVAE/resolve/main/Realistic_Vision_V5.1_fp16-no-ema.safetensors",user_home / r"stable-diffusion-webui" / r"models" / r"Stable-diffusion",r"Realistic_Vision_latest.safetensors")
94
+ #Lora Model
95
+ #Better Light
96
+ DownLoad(r"https://civitai.com/api/download/models/39885",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"Better_light.safetensors")
97
+ #Backlighting
98
+ DownLoad(r"https://civitai.com/api/download/models/39164",user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora",r"backlighting.safetensors")
99
+ #Add details
100
+ DownLoad(r"https://civitai.com/api/download/models/62833",str(user_home / r"stable-diffusion-webui" / r"extensions" / r"sd-webui-additional-networks" / r"models"/ r"lora"),r"add_detail.safetensors")
101
+ #GFPGAN Model
102
+ #detection Resnet50
103
+ 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")
104
+ #parsing_parsenet
105
+ 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")
106
+ #GFPGANv1.4
107
+ 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")
108
+ #strt Stable Diffusion Webui
109
+ print("Done\nStarting Webui...")
110
+ os.chdir(user_home / r"stable-diffusion-webui")
111
+ gc.collect()
112
+ while True:
113
+ ret=subprocess.run([executable ,user_home / r"stable-diffusion-webui" / r"launch.py",r"--precision",r"full",r"--no-half",r"--no-half-vae",r"--enable-insecure-extension-access",r"--medvram",r"--skip-torch-cuda-test",r"--enable-console-prompts",r"--ui-settings-file="+str(pathlib.Path(__file__).parent /r"config.json")])
114
+ if(ret.returncode == 0 ):
115
+ del ret
116
+ gc.collect()
117
+ else :
118
+ del ret
119
+ del os ,user_home ,pyexecutable ,subprocess
config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "sd_model_checkpoint": "Realistic_Vision_latest.safetensors",
3
+ "sd_vae": "Automatic",
4
+ "quicksettings_list": [
5
+ "sd_model_checkpoint",
6
+ "sd_vae",
7
+ "code_former_weight"
8
+ ]
9
+ }
packages.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ aria2
2
+ wget
requirements.txt ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GitPython
2
+ Pillow
3
+ accelerate
4
+
5
+ basicsr
6
+ blendmodes
7
+ clean-fid
8
+ einops
9
+ fastapi>=0.90.1
10
+ gfpgan
11
+ gradio==3.41.2
12
+ inflection
13
+ jsonmerge
14
+ kornia
15
+ lark
16
+ numpy
17
+ omegaconf
18
+ open-clip-torch
19
+
20
+ piexif
21
+ psutil
22
+ pytorch_lightning
23
+ realesrgan
24
+ requests
25
+ resize-right
26
+
27
+ safetensors
28
+ scikit-image>=0.19
29
+ timm
30
+ tomesd
31
+ torch
32
+ torchdiffeq
33
+ torchsde
34
+ transformers==4.30.2