test new prew dl result
Browse files- files_cells/notebooks/en/downloading_en.ipynb +25 -22
- files_cells/notebooks/ru/downloading_ru.ipynb +23 -19
- files_cells/python/en/downloading_en.py +25 -22
- files_cells/python/ru/downloading_ru.py +23 -19
- files_cells/special/notebooks/dl_display_results.ipynb +258 -0
- files_cells/special/python/dl_display_results.py +231 -0
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
|
@@ -86,7 +86,7 @@
|
|
| 86 |
"\n",
|
| 87 |
" # Additional manual installation steps for specific packages\n",
|
| 88 |
" with capture.capture_output() as cap:\n",
|
| 89 |
-
" !curl -s -OL https://
|
| 90 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 91 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
| 92 |
" del cap\n",
|
|
@@ -183,7 +183,7 @@
|
|
| 183 |
" if latest_exstensions:\n",
|
| 184 |
" !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
|
| 185 |
"\n",
|
| 186 |
-
" # My Chinese friend, you broke the images again in the latest update... >W<'\n",
|
| 187 |
" # %cd {webui_path}/extensions/Encrypt-Image\n",
|
| 188 |
" # !git reset --hard 376358d8854472b9ea50e9fc8800367d1ca51137 # stable commit :3\n",
|
| 189 |
" del cap\n",
|
|
@@ -547,27 +547,30 @@
|
|
| 547 |
" print(f\"\\r📦 Installed '{len(extension_repo)}', Custom extensions!\")\n",
|
| 548 |
"\n",
|
| 549 |
"\n",
|
| 550 |
-
"## List Models and stuff\n",
|
| 551 |
"if detailed_download == \"off\":\n",
|
| 552 |
-
" print(\"\\n\\n\\033[
|
| 553 |
-
"\n",
|
| 554 |
-
"
|
| 555 |
-
"
|
| 556 |
-
"
|
| 557 |
-
"if any(not file.endswith('.txt') for file in os.listdir(
|
| 558 |
-
"
|
| 559 |
-
"
|
| 560 |
-
"if any(not file.endswith('.txt')
|
| 561 |
-
"
|
| 562 |
-
"
|
| 563 |
-
"if any(not file.endswith('.txt') for file in os.listdir(
|
| 564 |
-
"
|
| 565 |
-
"
|
| 566 |
-
"
|
| 567 |
-
"
|
| 568 |
-
"
|
| 569 |
-
" print(\"\\n\\033[33m➤
|
| 570 |
-
"
|
|
|
|
|
|
|
|
|
|
| 571 |
"\n",
|
| 572 |
"\n",
|
| 573 |
"# === OTHER ===\n",
|
|
|
|
| 86 |
"\n",
|
| 87 |
" # Additional manual installation steps for specific packages\n",
|
| 88 |
" with capture.capture_output() as cap:\n",
|
| 89 |
+
" !curl -s -OL https://huggingface.co/NagisaNao/fast_repo/resolve/main/files_cells/special/python/dl_display_results.py --output-dir {root_path}/file_cell # dl display result\n",
|
| 90 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 91 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
| 92 |
" del cap\n",
|
|
|
|
| 183 |
" if latest_exstensions:\n",
|
| 184 |
" !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
|
| 185 |
"\n",
|
| 186 |
+
" # # My Chinese friend, you broke the images again in the latest update... >W<'\n",
|
| 187 |
" # %cd {webui_path}/extensions/Encrypt-Image\n",
|
| 188 |
" # !git reset --hard 376358d8854472b9ea50e9fc8800367d1ca51137 # stable commit :3\n",
|
| 189 |
" del cap\n",
|
|
|
|
| 547 |
" print(f\"\\r📦 Installed '{len(extension_repo)}', Custom extensions!\")\n",
|
| 548 |
"\n",
|
| 549 |
"\n",
|
| 550 |
+
"## List Models and stuff V2\n",
|
| 551 |
"if detailed_download == \"off\":\n",
|
| 552 |
+
" print(\"\\n\\n\\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.\")\n",
|
| 553 |
+
"\n",
|
| 554 |
+
" get_ipython().run_line_magic('run', '{root_path}/file_cell/dl_display_results.py') # display widgets result\n",
|
| 555 |
+
"\n",
|
| 556 |
+
"else:\n",
|
| 557 |
+
" if any(not file.endswith('.txt') for file in os.listdir(models_dir)):\n",
|
| 558 |
+
" print(\"\\n\\033[33m➤ Models\\033[0m\")\n",
|
| 559 |
+
" get_ipython().system(\"find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\\\n'\")\n",
|
| 560 |
+
" if any(not file.endswith('.txt') for file in os.listdir(vaes_dir)):\n",
|
| 561 |
+
" print(\"\\n\\033[33m➤ VAEs\\033[0m\")\n",
|
| 562 |
+
" get_ipython().system(\"find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\\\n'\")\n",
|
| 563 |
+
" if any(not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file)) for file in os.listdir(embeddings_dir)):\n",
|
| 564 |
+
" print(\"\\n\\033[33m➤ Embeddings\\033[0m\")\n",
|
| 565 |
+
" get_ipython().system(\"find {embeddings_dir}/ -mindepth 1 -maxdepth 1 \\\\( -name '*.pt' -or -name '*.safetensors' \\\\) -printf '%f\\\\n'\")\n",
|
| 566 |
+
" if any(not file.endswith('.txt') for file in os.listdir(loras_dir)):\n",
|
| 567 |
+
" print(\"\\n\\033[33m➤ LoRAs\\033[0m\")\n",
|
| 568 |
+
" get_ipython().system(\"find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\\\n'\")\n",
|
| 569 |
+
" print(f\"\\n\\033[33m➤ Extensions\\033[0m\")\n",
|
| 570 |
+
" get_ipython().system(\"find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\\\n'\")\n",
|
| 571 |
+
" if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir)):\n",
|
| 572 |
+
" print(\"\\n\\033[33m➤ ControlNet\\033[0m\")\n",
|
| 573 |
+
" get_ipython().system(\"find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\\\(.*\\\\)_fp16\\\\.safetensors$/\\\\1/'\")\n",
|
| 574 |
"\n",
|
| 575 |
"\n",
|
| 576 |
"# === OTHER ===\n",
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
|
@@ -86,6 +86,7 @@
|
|
| 86 |
"\n",
|
| 87 |
" # Additional manual installation steps for specific packages\n",
|
| 88 |
" with capture.capture_output() as cap:\n",
|
|
|
|
| 89 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
| 90 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 91 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
|
@@ -142,7 +143,7 @@
|
|
| 142 |
"# ================= MAIN CODE =================\n",
|
| 143 |
"if not os.path.exists(webui_path):\n",
|
| 144 |
" start_install = int(time.time())\n",
|
| 145 |
-
" print(\"⌚
|
| 146 |
" with capture.capture_output() as cap:\n",
|
| 147 |
" !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip -o repo.zip\n",
|
| 148 |
" !unzip -q -o repo.zip -d {webui_path}\n",
|
|
@@ -547,27 +548,30 @@
|
|
| 547 |
" print(f\"\\r📦 Установлено '{len(extension_repo)}', Кастомных расширений!\")\n",
|
| 548 |
"\n",
|
| 549 |
"\n",
|
| 550 |
-
"## List Models and stuff\n",
|
| 551 |
"if detailed_download == \"off\":\n",
|
| 552 |
" print(\"\\n\\n\\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.\")\n",
|
| 553 |
"\n",
|
| 554 |
-
"
|
| 555 |
-
"
|
| 556 |
-
"
|
| 557 |
-
"if any(not file.endswith('.txt') for file in os.listdir(
|
| 558 |
-
"
|
| 559 |
-
"
|
| 560 |
-
"if any(not file.endswith('.txt')
|
| 561 |
-
"
|
| 562 |
-
"
|
| 563 |
-
"if any(not file.endswith('.txt') for file in os.listdir(
|
| 564 |
-
"
|
| 565 |
-
"
|
| 566 |
-
"
|
| 567 |
-
"
|
| 568 |
-
"
|
| 569 |
-
" print(\"\\n\\033[33m➤
|
| 570 |
-
"
|
|
|
|
|
|
|
|
|
|
| 571 |
"\n",
|
| 572 |
"\n",
|
| 573 |
"# === OTHER ===\n",
|
|
|
|
| 86 |
"\n",
|
| 87 |
" # Additional manual installation steps for specific packages\n",
|
| 88 |
" with capture.capture_output() as cap:\n",
|
| 89 |
+
" !curl -s -OL https://huggingface.co/NagisaNao/fast_repo/resolve/main/files_cells/special/python/dl_display_results.py --output-dir {root_path}/file_cell # dl display result\n",
|
| 90 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
| 91 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
| 92 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz\n",
|
|
|
|
| 143 |
"# ================= MAIN CODE =================\n",
|
| 144 |
"if not os.path.exists(webui_path):\n",
|
| 145 |
" start_install = int(time.time())\n",
|
| 146 |
+
" print(\"⌚ Распаковка Stable Diffusion...\", end='')\n",
|
| 147 |
" with capture.capture_output() as cap:\n",
|
| 148 |
" !aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip -o repo.zip\n",
|
| 149 |
" !unzip -q -o repo.zip -d {webui_path}\n",
|
|
|
|
| 548 |
" print(f\"\\r📦 Установлено '{len(extension_repo)}', Кастомных расширений!\")\n",
|
| 549 |
"\n",
|
| 550 |
"\n",
|
| 551 |
+
"## List Models and stuff V2\n",
|
| 552 |
"if detailed_download == \"off\":\n",
|
| 553 |
" print(\"\\n\\n\\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.\")\n",
|
| 554 |
"\n",
|
| 555 |
+
" get_ipython().run_line_magic('run', '{root_path}/file_cell/dl_display_results.py') # display widgets result\n",
|
| 556 |
+
"\n",
|
| 557 |
+
"else:\n",
|
| 558 |
+
" if any(not file.endswith('.txt') for file in os.listdir(models_dir)):\n",
|
| 559 |
+
" print(\"\\n\\033[33m➤ Models\\033[0m\")\n",
|
| 560 |
+
" get_ipython().system(\"find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\\\n'\")\n",
|
| 561 |
+
" if any(not file.endswith('.txt') for file in os.listdir(vaes_dir)):\n",
|
| 562 |
+
" print(\"\\n\\033[33m➤ VAEs\\033[0m\")\n",
|
| 563 |
+
" get_ipython().system(\"find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\\\n'\")\n",
|
| 564 |
+
" if any(not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file)) for file in os.listdir(embeddings_dir)):\n",
|
| 565 |
+
" print(\"\\n\\033[33m➤ Embeddings\\033[0m\")\n",
|
| 566 |
+
" get_ipython().system(\"find {embeddings_dir}/ -mindepth 1 -maxdepth 1 \\\\( -name '*.pt' -or -name '*.safetensors' \\\\) -printf '%f\\\\n'\")\n",
|
| 567 |
+
" if any(not file.endswith('.txt') for file in os.listdir(loras_dir)):\n",
|
| 568 |
+
" print(\"\\n\\033[33m➤ LoRAs\\033[0m\")\n",
|
| 569 |
+
" get_ipython().system(\"find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\\\n'\")\n",
|
| 570 |
+
" print(f\"\\n\\033[33m➤ Extensions\\033[0m\")\n",
|
| 571 |
+
" get_ipython().system(\"find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\\\n'\")\n",
|
| 572 |
+
" if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir)):\n",
|
| 573 |
+
" print(\"\\n\\033[33m➤ ControlNet\\033[0m\")\n",
|
| 574 |
+
" get_ipython().system(\"find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\\\(.*\\\\)_fp16\\\\.safetensors$/\\\\1/'\")\n",
|
| 575 |
"\n",
|
| 576 |
"\n",
|
| 577 |
"# === OTHER ===\n",
|
files_cells/python/en/downloading_en.py
CHANGED
|
@@ -67,7 +67,7 @@ if not os.path.exists(flag_file):
|
|
| 67 |
|
| 68 |
# Additional manual installation steps for specific packages
|
| 69 |
with capture.capture_output() as cap:
|
| 70 |
-
get_ipython().system('curl -s -OL https://
|
| 71 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 72 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
| 73 |
del cap
|
|
@@ -164,7 +164,7 @@ 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 |
# %cd {webui_path}/extensions/Encrypt-Image
|
| 169 |
# !git reset --hard 376358d8854472b9ea50e9fc8800367d1ca51137 # stable commit :3
|
| 170 |
del cap
|
|
@@ -525,27 +525,30 @@ 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[
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
if any(not file.endswith('.txt') for file in os.listdir(
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
if any(not file.endswith('.txt')
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
if any(not file.endswith('.txt') for file in os.listdir(
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
print("\n\033[33m➤
|
| 548 |
-
get_ipython().system("find {
|
|
|
|
|
|
|
|
|
|
| 549 |
|
| 550 |
|
| 551 |
# === OTHER ===
|
|
|
|
| 67 |
|
| 68 |
# Additional manual installation steps for specific packages
|
| 69 |
with capture.capture_output() as cap:
|
| 70 |
+
get_ipython().system('curl -s -OL https://huggingface.co/NagisaNao/fast_repo/resolve/main/files_cells/special/python/dl_display_results.py --output-dir {root_path}/file_cell # dl display result')
|
| 71 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 72 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
| 73 |
del cap
|
|
|
|
| 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 |
# %cd {webui_path}/extensions/Encrypt-Image
|
| 169 |
# !git reset --hard 376358d8854472b9ea50e9fc8800367d1ca51137 # stable commit :3
|
| 170 |
del cap
|
|
|
|
| 525 |
print(f"\r📦 Installed '{len(extension_repo)}', Custom extensions!")
|
| 526 |
|
| 527 |
|
| 528 |
+
## List Models and stuff V2
|
| 529 |
if detailed_download == "off":
|
| 530 |
+
print("\n\n\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.")
|
| 531 |
+
|
| 532 |
+
get_ipython().run_line_magic('run', '{root_path}/file_cell/dl_display_results.py') # display widgets result
|
| 533 |
+
|
| 534 |
+
else:
|
| 535 |
+
if any(not file.endswith('.txt') for file in os.listdir(models_dir)):
|
| 536 |
+
print("\n\033[33m➤ Models\033[0m")
|
| 537 |
+
get_ipython().system("find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
|
| 538 |
+
if any(not file.endswith('.txt') for file in os.listdir(vaes_dir)):
|
| 539 |
+
print("\n\033[33m➤ VAEs\033[0m")
|
| 540 |
+
get_ipython().system("find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
|
| 541 |
+
if any(not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file)) for file in os.listdir(embeddings_dir)):
|
| 542 |
+
print("\n\033[33m➤ Embeddings\033[0m")
|
| 543 |
+
get_ipython().system("find {embeddings_dir}/ -mindepth 1 -maxdepth 1 \\( -name '*.pt' -or -name '*.safetensors' \\) -printf '%f\\n'")
|
| 544 |
+
if any(not file.endswith('.txt') for file in os.listdir(loras_dir)):
|
| 545 |
+
print("\n\033[33m➤ LoRAs\033[0m")
|
| 546 |
+
get_ipython().system("find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\n'")
|
| 547 |
+
print(f"\n\033[33m➤ Extensions\033[0m")
|
| 548 |
+
get_ipython().system("find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\n'")
|
| 549 |
+
if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir)):
|
| 550 |
+
print("\n\033[33m➤ ControlNet\033[0m")
|
| 551 |
+
get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
|
| 552 |
|
| 553 |
|
| 554 |
# === OTHER ===
|
files_cells/python/ru/downloading_ru.py
CHANGED
|
@@ -67,6 +67,7 @@ if not os.path.exists(flag_file):
|
|
| 67 |
|
| 68 |
# Additional manual installation steps for specific packages
|
| 69 |
with capture.capture_output() as cap:
|
|
|
|
| 70 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
| 71 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 72 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
|
@@ -123,7 +124,7 @@ adetailer_dir = f"{webui_path}/models/adetailer"
|
|
| 123 |
# ================= MAIN CODE =================
|
| 124 |
if not os.path.exists(webui_path):
|
| 125 |
start_install = int(time.time())
|
| 126 |
-
print("⌚
|
| 127 |
with capture.capture_output() as cap:
|
| 128 |
get_ipython().system('aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip -o repo.zip')
|
| 129 |
get_ipython().system('unzip -q -o repo.zip -d {webui_path}')
|
|
@@ -525,27 +526,30 @@ if len(extension_repo) > 0:
|
|
| 525 |
print(f"\r📦 Установлено '{len(extension_repo)}', Кастомных расширений!")
|
| 526 |
|
| 527 |
|
| 528 |
-
## List Models and stuff
|
| 529 |
if detailed_download == "off":
|
| 530 |
print("\n\n\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.")
|
| 531 |
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
if any(not file.endswith('.txt') for file in os.listdir(
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
if any(not file.endswith('.txt')
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
if any(not file.endswith('.txt') for file in os.listdir(
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
print("\n\033[33m➤
|
| 548 |
-
get_ipython().system("find {
|
|
|
|
|
|
|
|
|
|
| 549 |
|
| 550 |
|
| 551 |
# === OTHER ===
|
|
|
|
| 67 |
|
| 68 |
# Additional manual installation steps for specific packages
|
| 69 |
with capture.capture_output() as cap:
|
| 70 |
+
get_ipython().system('curl -s -OL https://huggingface.co/NagisaNao/fast_repo/resolve/main/files_cells/special/python/dl_display_results.py --output-dir {root_path}/file_cell # dl display result')
|
| 71 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
| 72 |
get_ipython().system('curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl')
|
| 73 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.23/zrok_0.4.23_linux_amd64.tar.gz && tar -xzf zrok_0.4.23_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.23_linux_amd64.tar.gz')
|
|
|
|
| 124 |
# ================= MAIN CODE =================
|
| 125 |
if not os.path.exists(webui_path):
|
| 126 |
start_install = int(time.time())
|
| 127 |
+
print("⌚ Распаковка Stable Diffusion...", end='')
|
| 128 |
with capture.capture_output() as cap:
|
| 129 |
get_ipython().system('aria2c --console-log-level=error -c -x 16 -s 16 -k 1M https://huggingface.co/NagisaNao/fast_repo/resolve/main/FULL_REPO.zip -o repo.zip')
|
| 130 |
get_ipython().system('unzip -q -o repo.zip -d {webui_path}')
|
|
|
|
| 526 |
print(f"\r📦 Установлено '{len(extension_repo)}', Кастомных расширений!")
|
| 527 |
|
| 528 |
|
| 529 |
+
## List Models and stuff V2
|
| 530 |
if detailed_download == "off":
|
| 531 |
print("\n\n\033[33mЕсли вы не видете каких-то скаченных файлов, включите в виджетах функцию 'Подробная Загрузка'.")
|
| 532 |
|
| 533 |
+
get_ipython().run_line_magic('run', '{root_path}/file_cell/dl_display_results.py') # display widgets result
|
| 534 |
+
|
| 535 |
+
else:
|
| 536 |
+
if any(not file.endswith('.txt') for file in os.listdir(models_dir)):
|
| 537 |
+
print("\n\033[33m➤ Models\033[0m")
|
| 538 |
+
get_ipython().system("find {models_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
|
| 539 |
+
if any(not file.endswith('.txt') for file in os.listdir(vaes_dir)):
|
| 540 |
+
print("\n\033[33m➤ VAEs\033[0m")
|
| 541 |
+
get_ipython().system("find {vaes_dir}/ -mindepth 1 ! -name '*.txt' -printf '%f\\n'")
|
| 542 |
+
if any(not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file)) for file in os.listdir(embeddings_dir)):
|
| 543 |
+
print("\n\033[33m➤ Embeddings\033[0m")
|
| 544 |
+
get_ipython().system("find {embeddings_dir}/ -mindepth 1 -maxdepth 1 \\( -name '*.pt' -or -name '*.safetensors' \\) -printf '%f\\n'")
|
| 545 |
+
if any(not file.endswith('.txt') for file in os.listdir(loras_dir)):
|
| 546 |
+
print("\n\033[33m➤ LoRAs\033[0m")
|
| 547 |
+
get_ipython().system("find {loras_dir}/ -mindepth 1 ! -name '*.keep' -printf '%f\\n'")
|
| 548 |
+
print(f"\n\033[33m➤ Extensions\033[0m")
|
| 549 |
+
get_ipython().system("find {extensions_dir}/ -mindepth 1 -maxdepth 1 ! -name '*.txt' -printf '%f\\n'")
|
| 550 |
+
if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir)):
|
| 551 |
+
print("\n\033[33m➤ ControlNet\033[0m")
|
| 552 |
+
get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
|
| 553 |
|
| 554 |
|
| 555 |
# === OTHER ===
|
files_cells/special/notebooks/dl_display_results.ipynb
ADDED
|
@@ -0,0 +1,258 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"nbformat": 4,
|
| 3 |
+
"nbformat_minor": 0,
|
| 4 |
+
"metadata": {
|
| 5 |
+
"colab": {
|
| 6 |
+
"provenance": []
|
| 7 |
+
},
|
| 8 |
+
"kernelspec": {
|
| 9 |
+
"name": "python3",
|
| 10 |
+
"display_name": "Python 3"
|
| 11 |
+
},
|
| 12 |
+
"language_info": {
|
| 13 |
+
"name": "python"
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"cells": [
|
| 17 |
+
{
|
| 18 |
+
"cell_type": "code",
|
| 19 |
+
"source": [
|
| 20 |
+
"##~ Display Download Results Widgets | by: ANXETY ~##\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"import re\n",
|
| 23 |
+
"import os\n",
|
| 24 |
+
"import json\n",
|
| 25 |
+
"import time\n",
|
| 26 |
+
"import ipywidgets as widgets\n",
|
| 27 |
+
"from ipywidgets import widgets, Layout, Label, Button, VBox, HBox\n",
|
| 28 |
+
"from IPython.display import display, HTML, Javascript, clear_output\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"# ================= DETECT ENV =================\n",
|
| 32 |
+
"def detect_environment():\n",
|
| 33 |
+
" free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)\n",
|
| 34 |
+
" environments = {\n",
|
| 35 |
+
" 'COLAB_GPU': ('Google Colab', \"/root\" if free_plan else \"/content\"),\n",
|
| 36 |
+
" 'KAGGLE_URL_BASE': ('Kaggle', \"/kaggle/working/content\")\n",
|
| 37 |
+
" }\n",
|
| 38 |
+
"\n",
|
| 39 |
+
" for env_var, (environment, path) in environments.items():\n",
|
| 40 |
+
" if env_var in os.environ:\n",
|
| 41 |
+
" return environment, path, free_plan\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"env, root_path, free_plan = detect_environment()\n",
|
| 44 |
+
"webui_path = f\"{root_path}/sdw\"\n",
|
| 45 |
+
"# ----------------------------------------------\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"\n",
|
| 48 |
+
"# CONFIG DIR\n",
|
| 49 |
+
"models_dir = f\"{webui_path}/models/Stable-diffusion\"\n",
|
| 50 |
+
"vaes_dir = f\"{webui_path}/models/VAE\"\n",
|
| 51 |
+
"embeddings_dir = f\"{webui_path}/embeddings\"\n",
|
| 52 |
+
"loras_dir = f\"{webui_path}/models/Lora\"\n",
|
| 53 |
+
"extensions_dir = f\"{webui_path}/extensions\"\n",
|
| 54 |
+
"control_dir = f\"{webui_path}/models/ControlNet\"\n",
|
| 55 |
+
"adetailer_dir = f\"{webui_path}/models/adetailer\"\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"# ==================== CSS ====================\n",
|
| 59 |
+
"CSS = \"\"\"\n",
|
| 60 |
+
"<style>\n",
|
| 61 |
+
"/* General Styles */\n",
|
| 62 |
+
".header,\n",
|
| 63 |
+
".header_outputs {\n",
|
| 64 |
+
" font-family: cursive;\n",
|
| 65 |
+
" font-size: 20px;\n",
|
| 66 |
+
" font-weight: bold;\n",
|
| 67 |
+
" text-align: center;\n",
|
| 68 |
+
"}\n",
|
| 69 |
+
".header {\n",
|
| 70 |
+
" color: #8b9dc3;\n",
|
| 71 |
+
" margin-bottom: 15px;\n",
|
| 72 |
+
"}\n",
|
| 73 |
+
".header_outputs {\n",
|
| 74 |
+
" color: #0083c0;\n",
|
| 75 |
+
" align-self: center;\n",
|
| 76 |
+
"}\n",
|
| 77 |
+
"\n",
|
| 78 |
+
"hr {\n",
|
| 79 |
+
" border-color: grey;\n",
|
| 80 |
+
" background-color: grey;\n",
|
| 81 |
+
" opacity: 0.25;\n",
|
| 82 |
+
" width: 1000px;\n",
|
| 83 |
+
"}\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"/* Element text style */\n",
|
| 86 |
+
".widget-html {\n",
|
| 87 |
+
" font-family: cursive;\n",
|
| 88 |
+
" font-size: 14px;\n",
|
| 89 |
+
" color: white !important;\n",
|
| 90 |
+
" user-select: none;\n",
|
| 91 |
+
"}\n",
|
| 92 |
+
"\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"/* Container style */\n",
|
| 95 |
+
".container {\n",
|
| 96 |
+
" position: relative;\n",
|
| 97 |
+
" flex-direction: column;\n",
|
| 98 |
+
" justify-content: flex-start;\n",
|
| 99 |
+
" align-items: center; /* Center horizontally */\n",
|
| 100 |
+
" position: relative;\n",
|
| 101 |
+
" background-color: #232323;\n",
|
| 102 |
+
" width: 1200px;\n",
|
| 103 |
+
" height: auto;\n",
|
| 104 |
+
" margin: 40px 10px 10px 10px;\n",
|
| 105 |
+
" padding: 10px 15px;\n",
|
| 106 |
+
" border-radius: 15px;\n",
|
| 107 |
+
" box-shadow: 0 0 50px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.3);\n",
|
| 108 |
+
" overflow: visible;\n",
|
| 109 |
+
" transition: all 0.5s ease-in-out;\n",
|
| 110 |
+
"}\n",
|
| 111 |
+
".container::after {\n",
|
| 112 |
+
" position: absolute;\n",
|
| 113 |
+
" top: 5px;\n",
|
| 114 |
+
" right: 10px;\n",
|
| 115 |
+
" content: \"ANXETY\";\n",
|
| 116 |
+
" font-weight: bold;\n",
|
| 117 |
+
" font-size: 24px;\n",
|
| 118 |
+
" color: rgba(0, 0, 0, 0.2);\n",
|
| 119 |
+
"}\n",
|
| 120 |
+
"\n",
|
| 121 |
+
".result_output {\n",
|
| 122 |
+
" flex-direction: row;\n",
|
| 123 |
+
" /* align-items: flex-start; */\n",
|
| 124 |
+
" flex-wrap: wrap;\n",
|
| 125 |
+
" overflow: visible;\n",
|
| 126 |
+
" box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);\n",
|
| 127 |
+
" border-radius: 8px;\n",
|
| 128 |
+
" background-color: #1f1f1f;\n",
|
| 129 |
+
" width: 95%;\n",
|
| 130 |
+
" padding: 10px 15px;\n",
|
| 131 |
+
"}\n",
|
| 132 |
+
"\n",
|
| 133 |
+
".outputs {\n",
|
| 134 |
+
" display: flex;\n",
|
| 135 |
+
" flex-wrap: wrap;\n",
|
| 136 |
+
" background-color: #181818;\n",
|
| 137 |
+
" padding: 10px 15px;\n",
|
| 138 |
+
" border-radius: 15px;\n",
|
| 139 |
+
" box-shadow: 0 0 8px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.3);\n",
|
| 140 |
+
" color: #c1c1c1;\n",
|
| 141 |
+
" margin: 8px;\n",
|
| 142 |
+
" transition: all 0.15s ease;\n",
|
| 143 |
+
" flex-grow: 1;\n",
|
| 144 |
+
"}\n",
|
| 145 |
+
".outputs:hover {\n",
|
| 146 |
+
" transform: scale(1.02);\n",
|
| 147 |
+
" background-color: #181718;\n",
|
| 148 |
+
"}\n",
|
| 149 |
+
"\n",
|
| 150 |
+
"/* setting the height of \"outputs\" containers */\n",
|
| 151 |
+
".outputs { max-height: 400px; }\n",
|
| 152 |
+
".extension { height: 300px; }\n",
|
| 153 |
+
"\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"/* Animation of elements */\n",
|
| 156 |
+
"\n",
|
| 157 |
+
".container,\n",
|
| 158 |
+
".outputs {\n",
|
| 159 |
+
" animation-name: showedResult;\n",
|
| 160 |
+
" animation-duration: 1s;\n",
|
| 161 |
+
"}\n",
|
| 162 |
+
".items {\n",
|
| 163 |
+
" animation-name: showedText;\n",
|
| 164 |
+
" animation-duration: 1s;\n",
|
| 165 |
+
"}\n",
|
| 166 |
+
"\n",
|
| 167 |
+
"@keyframes showedResult {\n",
|
| 168 |
+
" 0% {\n",
|
| 169 |
+
" transform: translate3d(0, 15%, 0) scale(0.98);\n",
|
| 170 |
+
" opacity: 0;\n",
|
| 171 |
+
" }\n",
|
| 172 |
+
" 100% {\n",
|
| 173 |
+
" transform: translate3d(0, 0, 0) scale(1);\n",
|
| 174 |
+
" opacity: 1;\n",
|
| 175 |
+
" }\n",
|
| 176 |
+
"}\n",
|
| 177 |
+
"\n",
|
| 178 |
+
"@keyframes showedText {\n",
|
| 179 |
+
" 0% {\n",
|
| 180 |
+
" transform: translate3d(-30%, 0, 0);\n",
|
| 181 |
+
" opacity: 0;\n",
|
| 182 |
+
" }\n",
|
| 183 |
+
" 100% {\n",
|
| 184 |
+
" transform: translate3d(0, 0, 0);\n",
|
| 185 |
+
" opacity: 1;\n",
|
| 186 |
+
" }\n",
|
| 187 |
+
"}\n",
|
| 188 |
+
"</style>\n",
|
| 189 |
+
"\"\"\"\n",
|
| 190 |
+
"\n",
|
| 191 |
+
"display(HTML(CSS))\n",
|
| 192 |
+
"# ==================== CSS ====================\n",
|
| 193 |
+
"\n",
|
| 194 |
+
"\n",
|
| 195 |
+
"# ==================== WIDGETS ====================\n",
|
| 196 |
+
"# --- global widgets ---\n",
|
| 197 |
+
"HR = widgets.HTML('<hr>')\n",
|
| 198 |
+
"\n",
|
| 199 |
+
"header_widget = widgets.HTML(value='<div class=\"header\">DOWNLOAD RESULTS | v0.2<div>')\n",
|
| 200 |
+
"\n",
|
| 201 |
+
"# Adding content to \"outputs_widgets_list\"\n",
|
| 202 |
+
"def output_container_generator(header, items):\n",
|
| 203 |
+
" header_widget = widgets.HTML(value=f'<div class=\"header_outputs\">{header} ➤</div>')\n",
|
| 204 |
+
" content = [widgets.HTML(value=f'<div class=\"items\">{item}</div>') for item in items]\n",
|
| 205 |
+
" container_widget = widgets.VBox([header_widget] + content).add_class(\"outputs\")\n",
|
| 206 |
+
" return container_widget\n",
|
| 207 |
+
"\n",
|
| 208 |
+
"\n",
|
| 209 |
+
"# Models\n",
|
| 210 |
+
"models_list = [file for file in os.listdir(models_dir) if not file.endswith('.txt')]\n",
|
| 211 |
+
"models_widget = output_container_generator('Models', models_list).add_class(\"model\")\n",
|
| 212 |
+
"# Vaes\n",
|
| 213 |
+
"vaes_list = [file for file in os.listdir(vaes_dir) if not file.endswith('.txt')]\n",
|
| 214 |
+
"vaes_widget = output_container_generator('VAEs', vaes_list).add_class(\"vae\")\n",
|
| 215 |
+
"# Embeddings\n",
|
| 216 |
+
"embeddings_list = [file for file in os.listdir(embeddings_dir) if not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file))]\n",
|
| 217 |
+
"embeddings_widget = output_container_generator('Embeddings', embeddings_list).add_class(\"embedding\")\n",
|
| 218 |
+
"# LoRAs\n",
|
| 219 |
+
"loras_list = [file for file in os.listdir(loras_dir) if not file.endswith('.txt')]\n",
|
| 220 |
+
"loras_widget = output_container_generator('LoRAs', loras_list).add_class(\"lora\")\n",
|
| 221 |
+
"# Extensions\n",
|
| 222 |
+
"extensions_list = [folder for folder in os.listdir(extensions_dir) if os.path.isdir(os.path.join(extensions_dir, folder))]\n",
|
| 223 |
+
"extensions_widget = output_container_generator('Extensions', extensions_list).add_class(\"extension\")\n",
|
| 224 |
+
"# ControlNet\n",
|
| 225 |
+
"# controlnets_list = [file for file in os.listdir(control_dir) if not file.endswith(('.txt', '.yaml'))]\n",
|
| 226 |
+
"filter_name = re.compile(r'^[^_]*_[^_]*_[^_]*_(.*)_fp16\\.safetensors$')\n",
|
| 227 |
+
"controlnets_list = [\n",
|
| 228 |
+
" filter_name.match(file).group(1) if filter_name.match(file) else file\n",
|
| 229 |
+
" for file in os.listdir(control_dir)\n",
|
| 230 |
+
" if not file.endswith(('.txt', '.yaml'))\n",
|
| 231 |
+
"]\n",
|
| 232 |
+
"controlnets_widget = output_container_generator('ControlNets', controlnets_list).add_class(\"controlnet\")\n",
|
| 233 |
+
"\n",
|
| 234 |
+
"\n",
|
| 235 |
+
"## Sorting and Output\n",
|
| 236 |
+
"widgets_dict = {\n",
|
| 237 |
+
" models_widget: models_list,\n",
|
| 238 |
+
" vaes_widget: vaes_list,\n",
|
| 239 |
+
" embeddings_widget: embeddings_list,\n",
|
| 240 |
+
" loras_widget: loras_list,\n",
|
| 241 |
+
" extensions_widget: extensions_list,\n",
|
| 242 |
+
" controlnets_widget: controlnets_list\n",
|
| 243 |
+
"}\n",
|
| 244 |
+
"outputs_widgets_list = [widget for widget, widget_list in widgets_dict.items() if widget_list]\n",
|
| 245 |
+
"result_output_widget = widgets.HBox(outputs_widgets_list).add_class(\"result_output\")\n",
|
| 246 |
+
"\n",
|
| 247 |
+
"container_widget = widgets.VBox([header_widget, HR, result_output_widget, HR]).add_class(\"container\")\n",
|
| 248 |
+
"\n",
|
| 249 |
+
"display(container_widget)"
|
| 250 |
+
],
|
| 251 |
+
"metadata": {
|
| 252 |
+
"id": "2lJmbqrs3Mu8"
|
| 253 |
+
},
|
| 254 |
+
"execution_count": null,
|
| 255 |
+
"outputs": []
|
| 256 |
+
}
|
| 257 |
+
]
|
| 258 |
+
}
|
files_cells/special/python/dl_display_results.py
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
##~ Display Download Results Widgets | by: ANXETY ~##
|
| 2 |
+
|
| 3 |
+
import re
|
| 4 |
+
import os
|
| 5 |
+
import json
|
| 6 |
+
import time
|
| 7 |
+
import ipywidgets as widgets
|
| 8 |
+
from ipywidgets import widgets, Layout, Label, Button, VBox, HBox
|
| 9 |
+
from IPython.display import display, HTML, Javascript, clear_output
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
# ================= DETECT ENV =================
|
| 13 |
+
def detect_environment():
|
| 14 |
+
free_plan = (os.sysconf('SC_PAGE_SIZE') * os.sysconf('SC_PHYS_PAGES') / (1024. ** 3) <= 20)
|
| 15 |
+
environments = {
|
| 16 |
+
'COLAB_GPU': ('Google Colab', "/root" if free_plan else "/content"),
|
| 17 |
+
'KAGGLE_URL_BASE': ('Kaggle', "/kaggle/working/content")
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
for env_var, (environment, path) in environments.items():
|
| 21 |
+
if env_var in os.environ:
|
| 22 |
+
return environment, path, free_plan
|
| 23 |
+
|
| 24 |
+
env, root_path, free_plan = detect_environment()
|
| 25 |
+
webui_path = f"{root_path}/sdw"
|
| 26 |
+
# ----------------------------------------------
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
# CONFIG DIR
|
| 30 |
+
models_dir = f"{webui_path}/models/Stable-diffusion"
|
| 31 |
+
vaes_dir = f"{webui_path}/models/VAE"
|
| 32 |
+
embeddings_dir = f"{webui_path}/embeddings"
|
| 33 |
+
loras_dir = f"{webui_path}/models/Lora"
|
| 34 |
+
extensions_dir = f"{webui_path}/extensions"
|
| 35 |
+
control_dir = f"{webui_path}/models/ControlNet"
|
| 36 |
+
adetailer_dir = f"{webui_path}/models/adetailer"
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
# ==================== CSS ====================
|
| 40 |
+
CSS = """
|
| 41 |
+
<style>
|
| 42 |
+
/* General Styles */
|
| 43 |
+
.header,
|
| 44 |
+
.header_outputs {
|
| 45 |
+
font-family: cursive;
|
| 46 |
+
font-size: 20px;
|
| 47 |
+
font-weight: bold;
|
| 48 |
+
text-align: center;
|
| 49 |
+
}
|
| 50 |
+
.header {
|
| 51 |
+
color: #8b9dc3;
|
| 52 |
+
margin-bottom: 15px;
|
| 53 |
+
}
|
| 54 |
+
.header_outputs {
|
| 55 |
+
color: #0083c0;
|
| 56 |
+
align-self: center;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
hr {
|
| 60 |
+
border-color: grey;
|
| 61 |
+
background-color: grey;
|
| 62 |
+
opacity: 0.25;
|
| 63 |
+
width: 1000px;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/* Element text style */
|
| 67 |
+
.widget-html {
|
| 68 |
+
font-family: cursive;
|
| 69 |
+
font-size: 14px;
|
| 70 |
+
color: white !important;
|
| 71 |
+
user-select: none;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
/* Container style */
|
| 76 |
+
.container {
|
| 77 |
+
position: relative;
|
| 78 |
+
flex-direction: column;
|
| 79 |
+
justify-content: flex-start;
|
| 80 |
+
align-items: center; /* Center horizontally */
|
| 81 |
+
position: relative;
|
| 82 |
+
background-color: #232323;
|
| 83 |
+
width: 1200px;
|
| 84 |
+
height: auto;
|
| 85 |
+
margin: 40px 10px 10px 10px;
|
| 86 |
+
padding: 10px 15px;
|
| 87 |
+
border-radius: 15px;
|
| 88 |
+
box-shadow: 0 0 50px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.3);
|
| 89 |
+
overflow: visible;
|
| 90 |
+
transition: all 0.5s ease-in-out;
|
| 91 |
+
}
|
| 92 |
+
.container::after {
|
| 93 |
+
position: absolute;
|
| 94 |
+
top: 5px;
|
| 95 |
+
right: 10px;
|
| 96 |
+
content: "ANXETY";
|
| 97 |
+
font-weight: bold;
|
| 98 |
+
font-size: 24px;
|
| 99 |
+
color: rgba(0, 0, 0, 0.2);
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.result_output {
|
| 103 |
+
flex-direction: row;
|
| 104 |
+
/* align-items: flex-start; */
|
| 105 |
+
flex-wrap: wrap;
|
| 106 |
+
overflow: visible;
|
| 107 |
+
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
|
| 108 |
+
border-radius: 8px;
|
| 109 |
+
background-color: #1f1f1f;
|
| 110 |
+
width: 95%;
|
| 111 |
+
padding: 10px 15px;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.outputs {
|
| 115 |
+
display: flex;
|
| 116 |
+
flex-wrap: wrap;
|
| 117 |
+
background-color: #181818;
|
| 118 |
+
padding: 10px 15px;
|
| 119 |
+
border-radius: 15px;
|
| 120 |
+
box-shadow: 0 0 8px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.3);
|
| 121 |
+
color: #c1c1c1;
|
| 122 |
+
margin: 8px;
|
| 123 |
+
transition: all 0.15s ease;
|
| 124 |
+
flex-grow: 1;
|
| 125 |
+
}
|
| 126 |
+
.outputs:hover {
|
| 127 |
+
transform: scale(1.02);
|
| 128 |
+
background-color: #181718;
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/* setting the height of "outputs" containers */
|
| 132 |
+
.outputs { max-height: 400px; }
|
| 133 |
+
.extension { height: 300px; }
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
/* Animation of elements */
|
| 137 |
+
|
| 138 |
+
.container,
|
| 139 |
+
.outputs {
|
| 140 |
+
animation-name: showedResult;
|
| 141 |
+
animation-duration: 1s;
|
| 142 |
+
}
|
| 143 |
+
.items {
|
| 144 |
+
animation-name: showedText;
|
| 145 |
+
animation-duration: 1s;
|
| 146 |
+
}
|
| 147 |
+
|
| 148 |
+
@keyframes showedResult {
|
| 149 |
+
0% {
|
| 150 |
+
transform: translate3d(0, 15%, 0) scale(0.98);
|
| 151 |
+
opacity: 0;
|
| 152 |
+
}
|
| 153 |
+
100% {
|
| 154 |
+
transform: translate3d(0, 0, 0) scale(1);
|
| 155 |
+
opacity: 1;
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
@keyframes showedText {
|
| 160 |
+
0% {
|
| 161 |
+
transform: translate3d(-30%, 0, 0);
|
| 162 |
+
opacity: 0;
|
| 163 |
+
}
|
| 164 |
+
100% {
|
| 165 |
+
transform: translate3d(0, 0, 0);
|
| 166 |
+
opacity: 1;
|
| 167 |
+
}
|
| 168 |
+
}
|
| 169 |
+
</style>
|
| 170 |
+
"""
|
| 171 |
+
|
| 172 |
+
display(HTML(CSS))
|
| 173 |
+
# ==================== CSS ====================
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
# ==================== WIDGETS ====================
|
| 177 |
+
# --- global widgets ---
|
| 178 |
+
HR = widgets.HTML('<hr>')
|
| 179 |
+
|
| 180 |
+
header_widget = widgets.HTML(value='<div class="header">DOWNLOAD RESULTS | v0.2<div>')
|
| 181 |
+
|
| 182 |
+
# Adding content to "outputs_widgets_list"
|
| 183 |
+
def output_container_generator(header, items):
|
| 184 |
+
header_widget = widgets.HTML(value=f'<div class="header_outputs">{header} ➤</div>')
|
| 185 |
+
content = [widgets.HTML(value=f'<div class="items">{item}</div>') for item in items]
|
| 186 |
+
container_widget = widgets.VBox([header_widget] + content).add_class("outputs")
|
| 187 |
+
return container_widget
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
# Models
|
| 191 |
+
models_list = [file for file in os.listdir(models_dir) if not file.endswith('.txt')]
|
| 192 |
+
models_widget = output_container_generator('Models', models_list).add_class("model")
|
| 193 |
+
# Vaes
|
| 194 |
+
vaes_list = [file for file in os.listdir(vaes_dir) if not file.endswith('.txt')]
|
| 195 |
+
vaes_widget = output_container_generator('VAEs', vaes_list).add_class("vae")
|
| 196 |
+
# Embeddings
|
| 197 |
+
embeddings_list = [file for file in os.listdir(embeddings_dir) if not file.endswith('.txt') and not os.path.isdir(os.path.join(embeddings_dir, file))]
|
| 198 |
+
embeddings_widget = output_container_generator('Embeddings', embeddings_list).add_class("embedding")
|
| 199 |
+
# LoRAs
|
| 200 |
+
loras_list = [file for file in os.listdir(loras_dir) if not file.endswith('.txt')]
|
| 201 |
+
loras_widget = output_container_generator('LoRAs', loras_list).add_class("lora")
|
| 202 |
+
# Extensions
|
| 203 |
+
extensions_list = [folder for folder in os.listdir(extensions_dir) if os.path.isdir(os.path.join(extensions_dir, folder))]
|
| 204 |
+
extensions_widget = output_container_generator('Extensions', extensions_list).add_class("extension")
|
| 205 |
+
# ControlNet
|
| 206 |
+
# controlnets_list = [file for file in os.listdir(control_dir) if not file.endswith(('.txt', '.yaml'))]
|
| 207 |
+
filter_name = re.compile(r'^[^_]*_[^_]*_[^_]*_(.*)_fp16\.safetensors$')
|
| 208 |
+
controlnets_list = [
|
| 209 |
+
filter_name.match(file).group(1) if filter_name.match(file) else file
|
| 210 |
+
for file in os.listdir(control_dir)
|
| 211 |
+
if not file.endswith(('.txt', '.yaml'))
|
| 212 |
+
]
|
| 213 |
+
controlnets_widget = output_container_generator('ControlNets', controlnets_list).add_class("controlnet")
|
| 214 |
+
|
| 215 |
+
|
| 216 |
+
## Sorting and Output
|
| 217 |
+
widgets_dict = {
|
| 218 |
+
models_widget: models_list,
|
| 219 |
+
vaes_widget: vaes_list,
|
| 220 |
+
embeddings_widget: embeddings_list,
|
| 221 |
+
loras_widget: loras_list,
|
| 222 |
+
extensions_widget: extensions_list,
|
| 223 |
+
controlnets_widget: controlnets_list
|
| 224 |
+
}
|
| 225 |
+
outputs_widgets_list = [widget for widget, widget_list in widgets_dict.items() if widget_list]
|
| 226 |
+
result_output_widget = widgets.HBox(outputs_widgets_list).add_class("result_output")
|
| 227 |
+
|
| 228 |
+
container_widget = widgets.VBox([header_widget, HR, result_output_widget, HR]).add_class("container")
|
| 229 |
+
|
| 230 |
+
display(container_widget)
|
| 231 |
+
|