gmk123 commited on
Commit
fe32590
·
verified ·
1 Parent(s): a3f3eb9

Update comfyui_tmp.py

Browse files
Files changed (1) hide show
  1. comfyui_tmp.py +82 -82
comfyui_tmp.py CHANGED
@@ -4,88 +4,88 @@ from IPython import get_ipython #line:3
4
  from IPython .utils import capture #line:4
5
  from IPython .display import clear_output #line:5
6
  wb =f'/home/studio-lab-user/ComfyUI'#line:8
7
- def gitDownload (O0O0O0O0OOO000O00 ,O00000O0O0OOOOO0O ):#line:11
8
- if os .path .exists (O00000O0O0OOOOO0O ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {O0O0O0O0OOO000O00} {O00000O0O0OOOOO0O}')#line:15
11
  def installAdditional ():#line:18
12
  get_ipython ().system (f'git clone --recursive https://github.com/ssitu/ComfyUI_UltimateSDUpscale {wb}/custom_nodes/ComfyUI_UltimateSDUpscale')#line:20
13
- OO000000OOO0OO00O =['https://github.com/ltdrdata/ComfyUI-Manager','https://github.com/pythongosssss/ComfyUI-Custom-Scripts','https://github.com/city96/SD-Latent-Upscaler','https://github.com/jags111/efficiency-nodes-comfyui','https://github.com/BlenderNeko/ComfyUI_ADV_CLIP_emb','https://github.com/ssitu/ComfyUI_NestedNodeBuilder','https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet','https://github.com/Fannovel16/comfyui_controlnet_aux','https://github.com/SLAPaper/ComfyUI-Image-Selector','https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes','https://github.com/FizzleDorf/ComfyUI_FizzNodes','https://github.com/WASasquatch/was-node-suite-comfyui','https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite','https://github.com/Gourieff/comfyui-reactor-node',]#line:38
14
- for OOO0OOO0O0O000O0O in OO000000OOO0OO00O :#line:39
15
- OOOO000OO0O000O00 =OOO0OOO0O0O000O0O .split ('/')[-1 ]#line:41
16
- if 'github'in OOO0OOO0O0O000O0O :#line:43
17
- get_ipython ().system (f'git clone --depth 1 {OOO0OOO0O0O000O0O} {wb}/custom_nodes/{OOOO000OO0O000O00}')#line:44
18
- get_ipython ().system (f'wget https://huggingface.co/pantat88/ui/resolve/main/embeddings.zip -O {wb}/models/embeddings/embeddings.zip')#line:47
19
- get_ipython ().system (f'unzip {wb}/models/embeddings/embeddings.zip -d {wb}/models/embeddings')#line:49
20
- get_ipython ().system (f'rm {wb}/models/embeddings/embeddings.zip')#line:50
21
- get_ipython ().system (f'wget https://civitai.com/api/download/models/150491 -O {wb}/models/embeddings/edgQuality.pt')#line:51
22
- clear_output ()#line:53
23
- import subprocess #line:55
24
- def sync_tmp_folder ():#line:57
25
- O0OOOO0OOOOOO00OO =[['rm','-rf','~/tmp/*','~/tmp','~/ComfyUI/models/checkpoints','~/ComfyUI/models/loras','~/ComfyUI/models/controlnet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/ComfyUI/models/checkpoints'],['ln','-vs','/tmp/Lora','~/ComfyUI/models/loras'],['ln','-vs','/tmp/ControlNet','~/ComfyUI/models/controlnet']]#line:64
26
- for O0OOO0OO0O0OOO0O0 in O0OOOO0OOOOOO00OO :#line:65
27
- O00000OO0O0O0000O =[os .path .expanduser (O0OOO00OO0OOO0O0O )for O0OOO00OO0OOO0O0O in O0OOO0OO0O0OOO0O0 ]#line:66
28
- subprocess .run (O00000OO0O0O0000O ,check =True )#line:67
29
- def run_command (O0OO00OOOOOO0OOO0 ,OOO00OOOO0000OOO0 ):#line:70
30
- print (f"Please wait, {OOO00OOOO0000OOO0} is loading...")#line:71
31
- subprocess .run (O0OO00OOOOOO0OOO0 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:72
32
- print (f"{OOO00OOOO0000OOO0} ok!")#line:73
33
- def zrok ():#line:76
34
- try :#line:77
35
- OOOOO0O000OO0O000 ="/home/studio-lab-user/.zrok/bin"#line:78
36
- os .makedirs (OOOOO0O000OO0O000 ,exist_ok =True )#line:79
37
- subprocess .run (["curl","-sLO","https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz"],check =True )#line:80
38
- subprocess .run (["tar","-xzf","zrok_0.4.23_linux_amd64.tar.gz","-C",OOOOO0O000OO0O000 ,"--wildcards","*zrok"],check =True )#line:81
39
- os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:82
40
- except Exception as OO00OO000OO000OOO :#line:84
41
- print (f"An error occurred: {OO00OO000OO000OOO}")#line:85
42
- def initLocal ():#line:89
43
- run_command ('conda install -y conda glib gxx_linux-64 ffmpeg imageio imageio-ffmpeg av gst-libav psutil pyngrok gperftools aria2 gdown','【 Installing Conda 】')#line:91
44
- run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:92
45
- run_command ('conda clean -y --all','【 Cleaning Conda 】')#line:93
46
- get_ipython ().system ('pip install -q tqdm')#line:97
47
- clear_output ()#line:99
48
- get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:100
49
- with capture .capture_output ()as OO0OO0OOO0OO00O00 :#line:103
50
- def OOOOO0OO0000OO00O (OOOOO000OO00O000O ,OO00O00O00OOOO000 ,O0O000OOO0OO0OO00 ):O0000OOO0OOOO0OOO =widgets .Button (description =OOOOO000OO00O000O ,disabled =True ,button_style =OO00O00O00OOOO000 ,layout =widgets .Layout (min_width =O0O000OOO0OO0OO00 ));display (O0000OOO0OOOO0OOO )#line:104
51
- get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:106
52
- with capture .capture_output ()as OO0OO0OOO0OO00O00 :#line:108
53
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:109
54
- get_ipython ().system ("pip install -q https://download.pytorch.org/whl/cu118/xformers-0.0.22.post4%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu118")#line:111
55
- get_ipython ().system ('pip install -q -r requirements.txt')#line:112
56
- get_ipython ().system ('pip install -q opencv-python==4.7.0.72 transformers==4.26.1 tokenizers clip-interrogator')#line:113
57
- if os .path .isfile ("custom_nodes/ComfyUI-Manager/scripts/colab-dependencies.py"):#line:115
58
- get_ipython ().system ("python custom_nodes/ComfyUI-Manager/scripts/colab-dependencies.py > /dev/null")#line:116
59
- get_ipython ().system ("rm -rf ~/.cache/* ~/ComfyUI/custom_nodes/")#line:118
60
- get_ipython ().system (f'pip install -q basicsr')#line:120
61
- clear_output ()#line:122
62
- zrok ()#line:126
63
- get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrun.py -O {wb}/zrun.py')#line:127
64
- get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrok.py -O {wb}/zrok.py')#line:128
65
- installAdditional ()#line:131
66
- sync_tmp_folder ()#line:134
67
- clear_output ()#line:141
68
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/192916 -d {wb}/models/checkpoints -o MoyouArtificial_v1060.safetensors')#line:143
69
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -d {wb}/models/vae -o vae-ft-mse-840000-ema-pruned.safetensors')#line:145
70
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x-UltraSharp.pth -d {wb}/models/upscale_models -o 4x-UltraSharp.pth')#line:147
71
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x-AnimeSharp.pth -d {wb}/models/upscale_models -o 4x-AnimeSharp.pth')#line:148
72
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/8x_RealESRGAN.pth -d {wb}/models/upscale_models -o 8x_RealESRGAN.pth')#line:149
73
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_RealisticRescaler_100000_G.pth -d {wb}/models/upscale_models -o 4x_RealisticRescaler_100000_G.pth')#line:150
74
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth -d {wb}/models/upscale_models -o 4x_NMKD-Superscale-SP_178000_G.pth')#line:151
75
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth -d {wb}/models/facerestore_models -o codeformer.pth')#line:153
76
- get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth -d {wb}/models/facerestore_models -o GFPGANv1.4.pth')#line:154
77
- wise =" --dont-print-server --preview-method auto --use-pytorch-cross-attention"#line:156
78
- ngrok_token =os .environ .get ('NGROK_TOKEN')#line:159
79
- wise +=f" --ngrok {ngrok_token}"#line:160
80
- def run (O000OO000O00OO00O ):#line:163
81
- clear_output ()#line:164
82
- print (f'建议使用第二步:zrok部署,无需魔法,没有流量限制')#line:165
83
- print (f'Ngrok注意事项:每个账号每月1G流量!需配合魔法使用')#line:166
84
- get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:167
85
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:169
86
- get_ipython ().system (f'python {O000OO000O00OO00O} {wise}')#line:170
87
- if os .path .exists (f'{wb}'):#line:173
88
- run (f'main.py')#line:175
89
- else :#line:176
90
- initLocal ()#line:178
91
- run (f'main.py')#line:181
 
4
  from IPython .utils import capture #line:4
5
  from IPython .display import clear_output #line:5
6
  wb =f'/home/studio-lab-user/ComfyUI'#line:8
7
+ def gitDownload (O0OOO00O0O00OO00O ,O000O00OOOO0O0OO0 ):#line:11
8
+ if os .path .exists (O000O00OOOO0O0OO0 ):#line:12
9
  return #line:13
10
+ get_ipython ().system (f'git clone {O0OOO00O0O00OO00O} {O000O00OOOO0O0OO0}')#line:15
11
  def installAdditional ():#line:18
12
  get_ipython ().system (f'git clone --recursive https://github.com/ssitu/ComfyUI_UltimateSDUpscale {wb}/custom_nodes/ComfyUI_UltimateSDUpscale')#line:20
13
+ O00OOO0O0O00O0000 =['https://github.com/ltdrdata/ComfyUI-Manager','https://github.com/pythongosssss/ComfyUI-Custom-Scripts','https://github.com/city96/SD-Latent-Upscaler','https://github.com/jags111/efficiency-nodes-comfyui','https://github.com/BlenderNeko/ComfyUI_ADV_CLIP_emb','https://github.com/ssitu/ComfyUI_NestedNodeBuilder','https://github.com/Kosinkadink/ComfyUI-Advanced-ControlNet','https://github.com/Fannovel16/comfyui_controlnet_aux','https://github.com/SLAPaper/ComfyUI-Image-Selector','https://github.com/Derfuu/Derfuu_ComfyUI_ModdedNodes','https://github.com/FizzleDorf/ComfyUI_FizzNodes','https://github.com/WASasquatch/was-node-suite-comfyui','https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite','https://github.com/Gourieff/comfyui-reactor-node','https://github.com/AIGODLIKE/AIGODLIKE-ComfyUI-Translation',]#line:39
14
+ for OOOOO0O00O0OO0OO0 in O00OOO0O0O00O0000 :#line:40
15
+ O00O000OOO0O0000O =OOOOO0O00O0OO0OO0 .split ('/')[-1 ]#line:42
16
+ if 'github'in OOOOO0O00O0OO0OO0 :#line:44
17
+ get_ipython ().system (f'git clone --depth 1 {OOOOO0O00O0OO0OO0} {wb}/custom_nodes/{O00O000OOO0O0000O}')#line:45
18
+ get_ipython ().system (f'wget https://huggingface.co/pantat88/ui/resolve/main/embeddings.zip -O {wb}/models/embeddings/embeddings.zip')#line:48
19
+ get_ipython ().system (f'unzip {wb}/models/embeddings/embeddings.zip -d {wb}/models/embeddings')#line:50
20
+ get_ipython ().system (f'rm {wb}/models/embeddings/embeddings.zip')#line:51
21
+ get_ipython ().system (f'wget https://civitai.com/api/download/models/150491 -O {wb}/models/embeddings/edgQuality.pt')#line:52
22
+ clear_output ()#line:54
23
+ import subprocess #line:56
24
+ def sync_tmp_folder ():#line:58
25
+ O00000O0000O0OOO0 =[['rm','-rf','~/tmp/*','~/tmp','~/ComfyUI/models/checkpoints','~/ComfyUI/models/loras','~/ComfyUI/models/controlnet'],['ln','-vs','/tmp','~/tmp'],['ln','-vs','/tmp/models','~/ComfyUI/models/checkpoints'],['ln','-vs','/tmp/Lora','~/ComfyUI/models/loras'],['ln','-vs','/tmp/ControlNet','~/ComfyUI/models/controlnet']]#line:65
26
+ for OOOO0OO00O0O0000O in O00000O0000O0OOO0 :#line:66
27
+ OOOOO00O0OO0OOOO0 =[os .path .expanduser (O0OO0OOOO0000OOOO )for O0OO0OOOO0000OOOO in OOOO0OO00O0O0000O ]#line:67
28
+ subprocess .run (OOOOO00O0OO0OOOO0 ,check =True )#line:68
29
+ def run_command (OO0OO00OO0OOO0OO0 ,OOOO00000OO0O0OO0 ):#line:71
30
+ print (f"Please wait, {OOOO00000OO0O0OO0} is loading...")#line:72
31
+ subprocess .run (OO0OO00OO0OOO0OO0 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:73
32
+ print (f"{OOOO00000OO0O0OO0} ok!")#line:74
33
+ def zrok ():#line:77
34
+ try :#line:78
35
+ OO0OOO0OOO0000OO0 ="/home/studio-lab-user/.zrok/bin"#line:79
36
+ os .makedirs (OO0OOO0OOO0000OO0 ,exist_ok =True )#line:80
37
+ subprocess .run (["curl","-sLO","https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz"],check =True )#line:81
38
+ subprocess .run (["tar","-xzf","zrok_0.4.23_linux_amd64.tar.gz","-C",OO0OOO0OOO0000OO0 ,"--wildcards","*zrok"],check =True )#line:82
39
+ os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:83
40
+ except Exception as O0000OOO0OO0OOO00 :#line:85
41
+ print (f"An error occurred: {O0000OOO0OO0OOO00}")#line:86
42
+ def initLocal ():#line:90
43
+ run_command ('conda install -y conda glib gxx_linux-64 ffmpeg imageio imageio-ffmpeg av gst-libav psutil pyngrok gperftools aria2 gdown','【 Installing Conda 】')#line:92
44
+ run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:93
45
+ run_command ('conda clean -y --all','【 Cleaning Conda 】')#line:94
46
+ get_ipython ().system ('pip install -q tqdm')#line:98
47
+ clear_output ()#line:100
48
+ get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:101
49
+ with capture .capture_output ()as O00O0OO0OOO00O0OO :#line:104
50
+ def O0000O00OOOOOO0O0 (OO000O00OOOOO0OO0 ,O0O00O00OO0OO0O0O ,O0OO000000000OO0O ):OO000OOO0O0O00O00 =widgets .Button (description =OO000O00OOOOO0OO0 ,disabled =True ,button_style =O0O00O00OO0OO0O0O ,layout =widgets .Layout (min_width =O0OO000000000OO0O ));display (OO000OOO0O0O00O00 )#line:105
51
+ get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:107
52
+ with capture .capture_output ()as O00O0OO0OOO00O0OO :#line:109
53
+ get_ipython ().run_line_magic ('cd',f'{wb}')#line:110
54
+ get_ipython ().system ("pip install -q https://download.pytorch.org/whl/cu118/xformers-0.0.22.post4%2Bcu118-cp310-cp310-manylinux2014_x86_64.whl -r requirements.txt --extra-index-url https://download.pytorch.org/whl/cu118")#line:112
55
+ get_ipython ().system ('pip install -q -r requirements.txt')#line:113
56
+ get_ipython ().system ('pip install -q opencv-python==4.7.0.72 transformers==4.26.1 tokenizers clip-interrogator')#line:114
57
+ if os .path .isfile ("custom_nodes/ComfyUI-Manager/scripts/colab-dependencies.py"):#line:116
58
+ get_ipython ().system ("python custom_nodes/ComfyUI-Manager/scripts/colab-dependencies.py > /dev/null")#line:117
59
+ get_ipython ().system ("rm -rf ~/.cache/* ~/ComfyUI/custom_nodes/")#line:119
60
+ get_ipython ().system (f'pip install -q basicsr')#line:121
61
+ clear_output ()#line:123
62
+ zrok ()#line:127
63
+ get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrun.py -O {wb}/zrun.py')#line:128
64
+ get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrok.py -O {wb}/zrok.py')#line:129
65
+ installAdditional ()#line:132
66
+ sync_tmp_folder ()#line:135
67
+ clear_output ()#line:142
68
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://civitai.com/api/download/models/192916 -d {wb}/models/checkpoints -o MoyouArtificial_v1060.safetensors')#line:144
69
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors -d {wb}/models/vae -o vae-ft-mse-840000-ema-pruned.safetensors')#line:146
70
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x-UltraSharp.pth -d {wb}/models/upscale_models -o 4x-UltraSharp.pth')#line:148
71
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x-AnimeSharp.pth -d {wb}/models/upscale_models -o 4x-AnimeSharp.pth')#line:149
72
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/8x_RealESRGAN.pth -d {wb}/models/upscale_models -o 8x_RealESRGAN.pth')#line:150
73
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_RealisticRescaler_100000_G.pth -d {wb}/models/upscale_models -o 4x_RealisticRescaler_100000_G.pth')#line:151
74
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/pantat88/ui/resolve/main/4x_NMKD-Superscale-SP_178000_G.pth -d {wb}/models/upscale_models -o 4x_NMKD-Superscale-SP_178000_G.pth')#line:152
75
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth -d {wb}/models/facerestore_models -o codeformer.pth')#line:154
76
+ get_ipython ().system (f'aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.pth -d {wb}/models/facerestore_models -o GFPGANv1.4.pth')#line:155
77
+ wise =" --listen --port 8188 --preview-method auto --enable-cors-header --use-pytorch-cross-attention --disable-xformers"#line:157
78
+ ngrok_token =os .environ .get ('NGROK_TOKEN')#line:160
79
+ wise +=f" --ngrok {ngrok_token}"#line:161
80
+ def run (O000OOO0OOOO0O0OO ):#line:164
81
+ clear_output ()#line:165
82
+ print (f'建议使用第二步:zrok部署,无需魔法,没有流量限制')#line:166
83
+ print (f'Ngrok注意事项:每个账号每月1G流量!需配合魔法使用')#line:167
84
+ get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:168
85
+ get_ipython ().run_line_magic ('cd',f'{wb}')#line:170
86
+ get_ipython ().system (f'python {O000OOO0OOOO0O0OO} {wise}')#line:171
87
+ if os .path .exists (f'{wb}'):#line:174
88
+ run (f'main.py')#line:176
89
+ else :#line:177
90
+ initLocal ()#line:179
91
+ run (f'main.py')#line:182