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

Update comfyui_tmp.py

Browse files
Files changed (1) hide show
  1. comfyui_tmp.py +81 -79
comfyui_tmp.py CHANGED
@@ -4,86 +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 (O0000OOOOO000OO0O ,OOO00OO0000OO0O00 ):#line:11
8
- if os .path .exists (OOO00OO0000OO0O00 ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {O0000OOOOO000OO0O} {OOO00OO0000OO0O00}')#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
- OOO00000O000OO0O0 =['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 O000O0OOOO0OOOOOO in OOO00000O000OO0O0 :#line:39
15
- O0O00000000OOO0O0 =O000O0OOOO0OOOOOO .split ('/')[-1 ]#line:41
16
- if 'github'in O000O0OOOO0OOOOOO :#line:43
17
- get_ipython ().system (f'git clone --depth 1 {O000O0OOOO0OOOOOO} {wb}/custom_nodes/{O0O00000000OOO0O0}')#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'wget https://civitai.com/api/download/models/150491 -O {wb}/models/embeddings/edgQuality.pt')#line:48
20
- clear_output ()#line:50
21
- import subprocess #line:52
22
- def sync_tmp_folder ():#line:54
23
- OO00OOOOO0O000O00 =[['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'],['unzip','-o','~/ComfyUI/models/embeddings.zip','-d','~/ComfyUI/models/embeddings'],['rm','~/ComfyUI/models/embeddings.zip']]#line:63
24
- for OO0O0OO0000OOO0O0 in OO00OOOOO0O000O00 :#line:64
25
- O000O0O00O0OOO0OO =[os .path .expanduser (OO0OO0000OOOOOOOO )for OO0OO0000OOOOOOOO in OO0O0OO0000OOO0O0 ]#line:65
26
- subprocess .run (O000O0O00O0OOO0OO ,check =True )#line:66
27
- def run_command (OOOOO00O0OOO0000O ,O000OO00O00OOOOOO ):#line:69
28
- print (f"Please wait, {O000OO00O00OOOOOO} is loading...")#line:70
29
- subprocess .run (OOOOO00O0OOO0000O ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:71
30
- print (f"{O000OO00O00OOOOOO} ok!")#line:72
31
- def zrok ():#line:75
32
- try :#line:76
33
- O0000OOOOOOO00O0O ="/home/studio-lab-user/.zrok/bin"#line:77
34
- os .makedirs (O0000OOOOOOO00O0O ,exist_ok =True )#line:78
35
- 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:79
36
- subprocess .run (["tar","-xzf","zrok_0.4.23_linux_amd64.tar.gz","-C",O0000OOOOOOO00O0O ,"--wildcards","*zrok"],check =True )#line:80
37
- os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:81
38
- except Exception as O0OOO0O00O00O00O0 :#line:83
39
- print (f"An error occurred: {O0OOO0O00O00O00O0}")#line:84
40
- def initLocal ():#line:88
41
- 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:90
42
- run_command ('conda install -y -n base python=3.10.12','【 Installing Python 3.10 】')#line:91
43
- run_command ('conda clean -y --all','【 Cleaning Conda 】')#line:92
44
- get_ipython ().system ('pip install -q tqdm')#line:96
45
- clear_output ()#line:98
46
- get_ipython ().run_line_magic ('cd','/home/studio-lab-user')#line:99
47
- with capture .capture_output ()as OO0000OOO00OOO000 :#line:102
48
- def OO0O0OO000O0OOOO0 (O0000O0OO00OOOO00 ,OO0000OOO000O00O0 ,OOO0O0O0000O0O0OO ):OOO0O00OOO0O00000 =widgets .Button (description =O0000O0OO00OOOO00 ,disabled =True ,button_style =OO0000OOO000O00O0 ,layout =widgets .Layout (min_width =OOO0O0O0000O0O0OO ));display (OOO0O00OOO0O00000 )#line:103
49
- get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:105
50
- with capture .capture_output ()as OO0000OOO00OOO000 :#line:107
51
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:108
52
- 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:110
53
- get_ipython ().system ('pip install -q -r requirements.txt')#line:111
54
- get_ipython ().system ('pip install -q opencv-python==4.7.0.72 transformers==4.26.1 tokenizers clip-interrogator')#line:112
55
- if os .path .isfile ("custom_nodes/ComfyUI-Manager/scripts/colab-dependencies.py"):#line:114
56
- get_ipython ().system ("python custom_nodes/ComfyUI-Manager/scripts/colab-dependencies.py > /dev/null")#line:115
57
- get_ipython ().system ("rm -rf ~/.cache/* ~/ComfyUI/custom_nodes/")#line:117
58
- get_ipython ().system (f'pip install -q basicsr')#line:119
59
- clear_output ()#line:121
60
- zrok ()#line:125
61
- get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrun.py -O {wb}/zrun.py')#line:126
62
- get_ipython ().system (f'wget https://huggingface.co/gmk123/comfyui/raw/main/zrok.py -O {wb}/zrok.py')#line:127
63
- installAdditional ()#line:130
64
- sync_tmp_folder ()#line:133
65
- clear_output ()#line:140
66
- 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:142
67
- 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:144
68
- 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:146
69
- 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:147
70
- 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: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_RealisticRescaler_100000_G.pth -d {wb}/models/upscale_models -o 4x_RealisticRescaler_100000_G.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/4x_NMKD-Superscale-SP_178000_G.pth -d {wb}/models/upscale_models -o 4x_NMKD-Superscale-SP_178000_G.pth')#line:150
73
- 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:152
74
- 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:153
75
- wise =" --dont-print-server --preview-method auto --use-pytorch-cross-attention"#line:155
76
- ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
77
- wise +=f" --ngrok {ngrok_token}"#line:159
78
- def run (O00O0O00O0O000OO0 ):#line:162
79
- clear_output ()#line:163
80
- print (f'建议使用第二步:zrok部署,无需魔法,没有流量限制')#line:164
81
- print (f'Ngrok注意事项:每个账号每月1G流量!需配合魔法使用')#line:165
82
- get_ipython ().system (f'mkdir -p /tmp/ControlNet')#line:166
83
- get_ipython ().run_line_magic ('cd',f'{wb}')#line:168
84
- get_ipython ().system (f'python {O00O0O00O0O000OO0} {wise}')#line:169
85
- if os .path .exists (f'{wb}'):#line:172
86
- run (f'main.py')#line:174
87
- else :#line:175
88
- initLocal ()#line:177
89
- run (f'main.py')#line:180
 
 
 
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