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

Update comfyui_tmp.py

Browse files
Files changed (1) hide show
  1. comfyui_tmp.py +27 -27
comfyui_tmp.py CHANGED
@@ -4,39 +4,39 @@ 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 (O000O0OO0O0OOOOO0 ,O00O0OOO00O0O0O0O ):#line:11
8
- if os .path .exists (O00O0OOO00O0O0O0O ):#line:12
9
  return #line:13
10
- get_ipython ().system (f'git clone {O000O0OO0O0OOOOO0} {O00O0OOO00O0O0O0O}')#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
- O0OOOOOOO0O00OO0O =['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 O0O0O0000OOOOOO00 in O0OOOOOOO0O00OO0O :#line:39
15
- OOO00OOO0OO0OOOOO =O0O0O0000OOOOOO00 .split ('/')[-1 ]#line:41
16
- if 'github'in O0O0O0000OOOOOO00 :#line:43
17
- get_ipython ().system (f'git clone --depth 1 {O0O0O0000OOOOOO00} {wb}/custom_nodes/{OOO00OOO0OO0OOOOO}')#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
- OO000OOOO00OO0OO0 =[['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 OOO0O0OO000000O0O in OO000OOOO00OO0OO0 :#line:64
25
- OOO0O0OOO0000O0O0 =[os .path .expanduser (OO00000O00OO000O0 )for OO00000O00OO000O0 in OOO0O0OO000000O0O ]#line:65
26
- subprocess .run (OOO0O0OOO0000O0O0 ,check =True )#line:66
27
- def run_command (OOO0OOO0O0O0O00O0 ,O0O00OOO00000O0O0 ):#line:69
28
- print (f"Please wait, {O0O00OOO00000O0O0} is loading...")#line:70
29
- subprocess .run (OOO0OOO0O0O0O00O0 ,shell =True ,stdout =subprocess .DEVNULL ,stderr =subprocess .DEVNULL )#line:71
30
- print (f"{O0O00OOO00000O0O0} ok!")#line:72
31
  def zrok ():#line:75
32
  try :#line:76
33
- O00OOOO0OO000OO00 ="/home/studio-lab-user/.zrok/bin"#line:77
34
- os .makedirs (O00OOOO0OO000OO00 ,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",O00OOOO0OO000OO00 ,"--wildcards","*zrok"],check =True )#line:80
37
  os .remove ("zrok_0.4.23_linux_amd64.tar.gz")#line:81
38
- except Exception as O0O00OO00000OOOO0 :#line:83
39
- print (f"An error occurred: {O0O00OO00000OOOO0}")#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
@@ -44,10 +44,10 @@ def initLocal ():#line:88
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 OO0OO0OOO00OOOOO0 :#line:102
48
- def OO000O0O0OO00000O (OOOOOO0O000O0O00O ,OO0O0O00OOOO00OOO ,O000OO00OOOOO0OO0 ):O00O00000O00O0O00 =widgets .Button (description =OOOOOO0O000O0O00O ,disabled =True ,button_style =OO0O0O00OOOO00OOO ,layout =widgets .Layout (min_width =O000OO00OOOOO0OO0 ));display (O00O00000O00O0O00 )#line:103
49
  get_ipython ().system (f'git clone -q https://github.com/comfyanonymous/ComfyUI {wb}')#line:105
50
- with capture .capture_output ()as OO0OO0OOO00OOOOO0 :#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
@@ -72,16 +72,16 @@ def initLocal ():#line:88
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 ="--xformers --enable-insecure-extension-access --theme dark --disable-console-progressbars --upcast-sampling"#line:155
76
  ngrok_token =os .environ .get ('NGROK_TOKEN')#line:158
77
  wise +=f" --ngrok {ngrok_token}"#line:159
78
- def run (OOO00OO0000000O00 ):#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 {OOO00OO0000000O00} {wise}')#line:169
85
  if os .path .exists (f'{wb}'):#line:172
86
  run (f'main.py')#line:174
87
  else :#line:175
 
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
 
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
 
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