ai202388 commited on
Commit
63cce77
·
verified ·
1 Parent(s): a1e01f9

Upload downloading_gg.py

Browse files
Files changed (1) hide show
  1. downloading_gg.py +36 -28
downloading_gg.py CHANGED
@@ -82,6 +82,12 @@ if not os.path.exists(flag_file):
82
  time.sleep(2)
83
  clear_output()
84
 
 
 
 
 
 
 
85
 
86
  # ================= loading settings V4 =================
87
  def load_settings(path):
@@ -164,9 +170,9 @@ if latest_webui or latest_exstensions:
164
  if latest_exstensions:
165
  get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
166
 
167
- # My Chinese friend, you broke the images again in the latest update... >W<'
168
- get_ipython().run_line_magic('cd', '{webui_path}/extensions/Encrypt-Image')
169
- get_ipython().system('git reset --hard 376358d8854472b9ea50e9fc8800367d1ca51137 # stable commit :3')
170
  del cap
171
  print(f"\r✨ {action} Completed!")
172
 
@@ -176,7 +182,7 @@ anxety_repos = "https://huggingface.co/NagisaNao/fast_repo/resolve/main"
176
 
177
  with capture.capture_output() as cap:
178
  # --- Umi-Wildcard ---
179
- # get_ipython().system("sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default")
180
 
181
  # --- Encrypt-Image ---
182
  get_ipython().system("sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui")
@@ -494,7 +500,7 @@ if custom_file_urls:
494
 
495
  # url prefixing
496
  urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]
497
- prefixed_urls = [f"{prefix}:{url}" for prefix, url in zip(prefixes.keys(), urls) if url]
498
  url += ", ".join(prefixed_urls) + ", " + file_urls
499
 
500
  if detailed_download == "on":
@@ -510,7 +516,7 @@ print("\r🏁 Download Complete!" + " "*15)
510
 
511
 
512
  # Cleaning shit after downloading...
513
- get_ipython().system('find {webui_path} \\( -type d \\( -name ".ipynb_checkpoints" -o -name ".aria2" \\) -o -type f -name "*.aria2" \\) -exec rm -r {{}} \\; >/dev/null 2>&1')
514
 
515
 
516
  ## Install of Custom extensions
@@ -525,27 +531,29 @@ if len(extension_repo) > 0:
525
  print(f"\r📦 Installed '{len(extension_repo)}', Custom extensions!")
526
 
527
 
528
- ## List Models and stuff
529
  if detailed_download == "off":
530
- print("\n\n\033[33mIf you don't see any downloaded files, enable the 'Detailed Downloads' feature in the widget.")
531
-
532
- if any(not file.endswith('.txt') for file in os.listdir(models_dir)):
533
- print("\n\033[33m➤ Models\033[0m")
534
- get_ipython().system("find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
535
- if any(not file.endswith('.txt') for file in os.listdir(vaes_dir)):
536
- print("\n\033[33m➤ VAEs\033[0m")
537
- get_ipython().system("find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
538
- if any(not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file)) for file in os.listdir(embeddings_dir)):
539
- print("\n\033[33m➤ Embeddings\033[0m")
540
- get_ipython().system("find {embeddings_dir}/ -mindepth 1 -maxdepth 1 \\( -name '*.pt' -or -name '*.safetensors' \\) -printf '%f\\n'")
541
- if any(not file.endswith('.txt') for file in os.listdir(loras_dir)):
542
- print("\n\033[33m➤ LoRAs\033[0m")
543
- get_ipython().system("find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\n'")
544
- print(f"\n\033[33m➤ Extensions\033[0m")
545
- get_ipython().system("find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\n'")
546
- if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir)):
547
- print("\n\033[33m➤ ControlNet\033[0m")
548
- get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
 
 
549
 
550
 
551
  # === OTHER ===
@@ -557,7 +565,7 @@ if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir))
557
  #save_dir_path = f"{webui_path}/extensions/Umi-AI-Wildcards/wildcards/discord"
558
 
559
  #with capture.capture_output() as cap:
560
- # for file in files_umi:
561
- # get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
562
  #del cap
563
 
 
82
  time.sleep(2)
83
  clear_output()
84
 
85
+ ## dl special files
86
+ with capture.capture_output() as cap:
87
+ get_ipython().system('mkdir -p {root_path}/file_cell/special')
88
+ get_ipython().system('wget https://huggingface.co/NagisaNao/test/resolve/main/files_cells/special/python/dl_display_results.py -O {root_path}/file_cell/special/dl_display_results.py')
89
+ del cap
90
+
91
 
92
  # ================= loading settings V4 =================
93
  def load_settings(path):
 
170
  if latest_exstensions:
171
  get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
172
 
173
+ # # My Chinese friend, you broke the images again in the latest update... >W<'
174
+ # %cd {webui_path}/extensions/Encrypt-Image
175
+ # !git reset --hard 376358d8854472b9ea50e9fc8800367d1ca51137 # stable commit :3
176
  del cap
177
  print(f"\r✨ {action} Completed!")
178
 
 
182
 
183
  with capture.capture_output() as cap:
184
  # --- Umi-Wildcard ---
185
+ #get_ipython().system("sed -i '521s/open=\\(False\\|True\\)/open=False/' {webui_path}/extensions/Umi-AI-Wildcards/scripts/wildcard_recursive.py # Closed accordion by default")
186
 
187
  # --- Encrypt-Image ---
188
  get_ipython().system("sed -i '9,37d' {webui_path}/extensions/Encrypt-Image/javascript/encrypt_images_info.js # Removes the weird text in webui")
 
500
 
501
  # url prefixing
502
  urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]
503
+ prefixed_urls = [f"{prefix}:{url}" for prefix, url in zip(prefixes.keys(), urls) if url for url in url.replace(',', '').split()]
504
  url += ", ".join(prefixed_urls) + ", " + file_urls
505
 
506
  if detailed_download == "on":
 
516
 
517
 
518
  # Cleaning shit after downloading...
519
+ #get_ipython().system('find {webui_path} \\( -type d \\( -name ".ipynb_checkpoints" -o -name ".aria2" \\) -o -type f -name "*.aria2" \\) -exec rm -r {{}} \\; >/dev/null 2>&1')
520
 
521
 
522
  ## Install of Custom extensions
 
531
  print(f"\r📦 Installed '{len(extension_repo)}', Custom extensions!")
532
 
533
 
534
+ ## List Models and stuff V2
535
  if detailed_download == "off":
536
+ print("\n\n\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.")
537
+ get_ipython().run_line_magic('run', '{root_path}/file_cell/special/dl_display_results.py') # display widgets result
538
+
539
+ else:
540
+ if any(not file.endswith('.txt') for file in os.listdir(models_dir)):
541
+ print("\n\033[33m➤ Models\033[0m")
542
+ get_ipython().system("find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
543
+ if any(not file.endswith('.txt') for file in os.listdir(vaes_dir)):
544
+ print("\n\033[33m➤ VAEs\033[0m")
545
+ get_ipython().system("find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
546
+ if any(not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file)) for file in os.listdir(embeddings_dir)):
547
+ print("\n\033[33m➤ Embeddings\033[0m")
548
+ get_ipython().system("find {embeddings_dir}/ -mindepth 1 -maxdepth 1 \\( -name '*.pt' -or -name '*.safetensors' \\) -printf '%f\\n'")
549
+ if any(not file.endswith('.txt') for file in os.listdir(loras_dir)):
550
+ print("\n\033[33m➤ LoRAs\033[0m")
551
+ get_ipython().system("find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\n'")
552
+ print(f"\n\033[33m➤ Extensions\033[0m")
553
+ get_ipython().system("find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\n'")
554
+ if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir)):
555
+ print("\n\033[33m➤ ControlNet\033[0m")
556
+ get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
557
 
558
 
559
  # === OTHER ===
 
565
  #save_dir_path = f"{webui_path}/extensions/Umi-AI-Wildcards/wildcards/discord"
566
 
567
  #with capture.capture_output() as cap:
568
+ # for file in files_umi:
569
+ # get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
570
  #del cap
571