add file text url downlaod
Browse files- files_cells/notebooks/en/downloading_en.ipynb +70 -1
- files_cells/notebooks/en/widgets_en.ipynb +20 -10
- files_cells/notebooks/ru/downloading_ru.ipynb +70 -1
- files_cells/notebooks/ru/widgets_ru.ipynb +20 -10
- files_cells/python/en/downloading_en.py +70 -1
- files_cells/python/en/widgets_en.py +20 -10
- files_cells/python/ru/downloading_ru.py +70 -1
- files_cells/python/ru/widgets_ru.py +20 -10
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
@@ -17,12 +17,15 @@
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
|
|
|
|
20 |
"import os\n",
|
21 |
"import re\n",
|
22 |
"import sys\n",
|
23 |
"import time\n",
|
24 |
"import json\n",
|
25 |
"import shutil\n",
|
|
|
26 |
"import subprocess\n",
|
27 |
"from datetime import timedelta\n",
|
28 |
"from subprocess import getoutput\n",
|
@@ -113,7 +116,7 @@
|
|
113 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
114 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
115 |
" 'ngrok_token' 'commandline_arguments',\n",
|
116 |
-
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'\n",
|
117 |
"]\n",
|
118 |
"\n",
|
119 |
"locals().update({key: settings.get(key) for key in variables})\n",
|
@@ -416,6 +419,58 @@
|
|
416 |
"\n",
|
417 |
" url += f\"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, \"\n",
|
418 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
"urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]\n",
|
420 |
"\n",
|
421 |
"for i, prefix in enumerate(prefixes):\n",
|
@@ -478,6 +533,20 @@
|
|
478 |
" !find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'\n",
|
479 |
"\n",
|
480 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
"# === ONLY SAGEMAKER ===\n",
|
482 |
"if env == \"SageMaker Studio Lab\":\n",
|
483 |
" with capture.capture_output() as cap:\n",
|
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
20 |
+
"##~ DOWNLOADING CODE | BY: ANXETY ~##\n",
|
21 |
+
"\n",
|
22 |
"import os\n",
|
23 |
"import re\n",
|
24 |
"import sys\n",
|
25 |
"import time\n",
|
26 |
"import json\n",
|
27 |
"import shutil\n",
|
28 |
+
"import requests\n",
|
29 |
"import subprocess\n",
|
30 |
"from datetime import timedelta\n",
|
31 |
"from subprocess import getoutput\n",
|
|
|
116 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
117 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
118 |
" 'ngrok_token' 'commandline_arguments',\n",
|
119 |
+
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'\n",
|
120 |
"]\n",
|
121 |
"\n",
|
122 |
"locals().update({key: settings.get(key) for key in variables})\n",
|
|
|
419 |
"\n",
|
420 |
" url += f\"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, \"\n",
|
421 |
"\n",
|
422 |
+
"def process_file_download(file_url):\n",
|
423 |
+
" global Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url\n",
|
424 |
+
"\n",
|
425 |
+
" tags = ['model', 'vae', 'embed', 'lora', 'extension']\n",
|
426 |
+
" current_tag = None\n",
|
427 |
+
"\n",
|
428 |
+
" if file_url.startswith(\"http\"):\n",
|
429 |
+
" if \"blob\" in file_url:\n",
|
430 |
+
" file_url = file_url.replace(\"blob\", \"raw\")\n",
|
431 |
+
"\n",
|
432 |
+
" response = requests.get(file_url)\n",
|
433 |
+
" lines = response.text.split('\\n')\n",
|
434 |
+
" else:\n",
|
435 |
+
" with open(file_url, 'r') as file:\n",
|
436 |
+
" lines = file.readlines()\n",
|
437 |
+
"\n",
|
438 |
+
" for line in lines:\n",
|
439 |
+
" if not line.strip():\n",
|
440 |
+
" continue\n",
|
441 |
+
"\n",
|
442 |
+
" if line.strip().startswith('#'):\n",
|
443 |
+
" current_tag = next((tag for tag in tags if tag in line.lower()), None)\n",
|
444 |
+
" elif current_tag:\n",
|
445 |
+
" urls = [url.strip() for url in line.split()]\n",
|
446 |
+
" for url in urls:\n",
|
447 |
+
" if url and (url.startswith(\"http\") or url.startswith(\"https\")):\n",
|
448 |
+
" if current_tag == 'model':\n",
|
449 |
+
" Model_url += \", \" + url\n",
|
450 |
+
" elif current_tag == 'vae':\n",
|
451 |
+
" Vae_url += \", \" + url\n",
|
452 |
+
" elif current_tag == 'embed':\n",
|
453 |
+
" Embedding_url += \", \" + url\n",
|
454 |
+
" elif current_tag == 'lora':\n",
|
455 |
+
" LoRA_url += \", \" + url\n",
|
456 |
+
" elif current_tag == 'extension':\n",
|
457 |
+
" Extensions_url += \", \" + url\n",
|
458 |
+
"\n",
|
459 |
+
"# fix all possible errors/options and function call\n",
|
460 |
+
"if custom_file_urls:\n",
|
461 |
+
" if not custom_file_urls.endswith('.txt'):\n",
|
462 |
+
" custom_file_urls += '.txt'\n",
|
463 |
+
" if not custom_file_urls.startswith('http'):\n",
|
464 |
+
" if not custom_file_urls.startswith(root_path):\n",
|
465 |
+
" custom_file_urls = f'{root_path}/{custom_file_urls}'\n",
|
466 |
+
" if custom_file_urls.count('/content') >= 2:\n",
|
467 |
+
" custom_file_urls = re.sub(r'(/content){2,}', '/content', custom_file_urls)\n",
|
468 |
+
"\n",
|
469 |
+
" try:\n",
|
470 |
+
" process_file_download(custom_file_urls)\n",
|
471 |
+
" except FileNotFoundError:\n",
|
472 |
+
" pass\n",
|
473 |
+
"\n",
|
474 |
"urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]\n",
|
475 |
"\n",
|
476 |
"for i, prefix in enumerate(prefixes):\n",
|
|
|
533 |
" !find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'\n",
|
534 |
"\n",
|
535 |
"\n",
|
536 |
+
"# === OTHER ===\n",
|
537 |
+
"# Downlaod discord tags UmiWildcards\n",
|
538 |
+
"files_umi = [\n",
|
539 |
+
" \"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/200_pan_gen.txt\",\n",
|
540 |
+
" \"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/150_bra_gen.txt\"\n",
|
541 |
+
"]\n",
|
542 |
+
"save_dir_path = f\"{webui_path}/extensions/Umi-AI-Wildcards/wildcards/discord\"\n",
|
543 |
+
"\n",
|
544 |
+
"with capture.capture_output() as cap:\n",
|
545 |
+
" for file in files_umi:\n",
|
546 |
+
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}\n",
|
547 |
+
"del cap\n",
|
548 |
+
"\n",
|
549 |
+
"\n",
|
550 |
"# === ONLY SAGEMAKER ===\n",
|
551 |
"if env == \"SageMaker Studio Lab\":\n",
|
552 |
" with capture.capture_output() as cap:\n",
|
files_cells/notebooks/en/widgets_en.ipynb
CHANGED
@@ -17,6 +17,8 @@
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
|
|
|
|
20 |
"import os\n",
|
21 |
"import sys\n",
|
22 |
"import json\n",
|
@@ -41,14 +43,9 @@
|
|
41 |
"\n",
|
42 |
"env, root_path = detect_environment()\n",
|
43 |
"webui_path = f\"{root_path}/sdw\"\n",
|
44 |
-
"# ----------------------------------------------\n",
|
45 |
"\n",
|
46 |
"!mkdir -p {root_path}\n",
|
47 |
-
"
|
48 |
-
"\n",
|
49 |
-
"style = {'description_width': 'initial'}\n",
|
50 |
-
"layout = widgets.Layout(min_width='1047px')\n",
|
51 |
-
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
52 |
"\n",
|
53 |
"\n",
|
54 |
"# ==================== CSS JS ====================\n",
|
@@ -104,7 +101,7 @@
|
|
104 |
"}\n",
|
105 |
"\n",
|
106 |
".container_custom_downlad.expanded {\n",
|
107 |
-
" height:
|
108 |
"}\n",
|
109 |
"\n",
|
110 |
"\n",
|
@@ -304,6 +301,12 @@
|
|
304 |
"\n",
|
305 |
"\n",
|
306 |
"# ==================== WIDGETS ====================\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
"# --- MODEL ---\n",
|
308 |
"model_header = widgets.HTML('<div class=\"header\">Model Selection<div>')\n",
|
309 |
"model_options = ['none',\n",
|
@@ -359,7 +362,9 @@
|
|
359 |
"commandline_arguments_options = \"--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers\"\n",
|
360 |
"commandline_arguments_widget = widgets.Text(description='Arguments:', value=commandline_arguments_options, style=style, layout=layout)\n",
|
361 |
"\n",
|
362 |
-
"display(widgets.VBox([
|
|
|
|
|
363 |
"\n",
|
364 |
"# --- CUSTOM DOWNLOAD ---\n",
|
365 |
"custom_download_header_popup = widgets.HTML('''\n",
|
@@ -393,8 +398,11 @@
|
|
393 |
"LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)\n",
|
394 |
"Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)\n",
|
395 |
"Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)\n",
|
|
|
396 |
"\n",
|
397 |
-
"display(widgets.VBox([
|
|
|
|
|
398 |
"\n",
|
399 |
"# --- Save Button ---\n",
|
400 |
"save_button = widgets.Button(description='Save').add_class(\"button_save\")\n",
|
@@ -402,13 +410,15 @@
|
|
402 |
"\n",
|
403 |
"\n",
|
404 |
"# ============ Load / Save - Settings V2 ============\n",
|
|
|
|
|
405 |
"settings_keys = [\n",
|
406 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
407 |
" 'Vae', 'Vae_Num',\n",
|
408 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
409 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
410 |
" 'ngrok_token', 'commandline_arguments',\n",
|
411 |
-
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'\n",
|
412 |
"]\n",
|
413 |
"\n",
|
414 |
"def save_settings():\n",
|
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
20 |
+
"##~ WIDGET CODE | BY: ANXETY ~##\n",
|
21 |
+
"\n",
|
22 |
"import os\n",
|
23 |
"import sys\n",
|
24 |
"import json\n",
|
|
|
43 |
"\n",
|
44 |
"env, root_path = detect_environment()\n",
|
45 |
"webui_path = f\"{root_path}/sdw\"\n",
|
|
|
46 |
"\n",
|
47 |
"!mkdir -p {root_path}\n",
|
48 |
+
"# ----------------------------------------------\n",
|
|
|
|
|
|
|
|
|
49 |
"\n",
|
50 |
"\n",
|
51 |
"# ==================== CSS JS ====================\n",
|
|
|
101 |
"}\n",
|
102 |
"\n",
|
103 |
".container_custom_downlad.expanded {\n",
|
104 |
+
" height: 270px;\n",
|
105 |
"}\n",
|
106 |
"\n",
|
107 |
"\n",
|
|
|
301 |
"\n",
|
302 |
"\n",
|
303 |
"# ==================== WIDGETS ====================\n",
|
304 |
+
"# --- global widgets ---\n",
|
305 |
+
"style = {'description_width': 'initial'}\n",
|
306 |
+
"layout = widgets.Layout(min_width='1047px')\n",
|
307 |
+
"\n",
|
308 |
+
"HR = widgets.HTML('<hr>')\n",
|
309 |
+
"\n",
|
310 |
"# --- MODEL ---\n",
|
311 |
"model_header = widgets.HTML('<div class=\"header\">Model Selection<div>')\n",
|
312 |
"model_options = ['none',\n",
|
|
|
362 |
"commandline_arguments_options = \"--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers\"\n",
|
363 |
"commandline_arguments_widget = widgets.Text(description='Arguments:', value=commandline_arguments_options, style=style, layout=layout)\n",
|
364 |
"\n",
|
365 |
+
"display(widgets.VBox([\n",
|
366 |
+
" additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, HR, commandline_arguments_widget\n",
|
367 |
+
" ]).add_class(\"container\"))\n",
|
368 |
"\n",
|
369 |
"# --- CUSTOM DOWNLOAD ---\n",
|
370 |
"custom_download_header_popup = widgets.HTML('''\n",
|
|
|
398 |
"LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)\n",
|
399 |
"Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)\n",
|
400 |
"Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)\n",
|
401 |
+
"custom_file_urls_widget = widgets.Text(description='File (txt):', style=style, layout=layout)\n",
|
402 |
"\n",
|
403 |
+
"display(widgets.VBox([\n",
|
404 |
+
" custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget\n",
|
405 |
+
" ]).add_class(\"container\").add_class(\"container_custom_downlad\"))\n",
|
406 |
"\n",
|
407 |
"# --- Save Button ---\n",
|
408 |
"save_button = widgets.Button(description='Save').add_class(\"button_save\")\n",
|
|
|
410 |
"\n",
|
411 |
"\n",
|
412 |
"# ============ Load / Save - Settings V2 ============\n",
|
413 |
+
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
414 |
+
"\n",
|
415 |
"settings_keys = [\n",
|
416 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
417 |
" 'Vae', 'Vae_Num',\n",
|
418 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
419 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
420 |
" 'ngrok_token', 'commandline_arguments',\n",
|
421 |
+
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'\n",
|
422 |
"]\n",
|
423 |
"\n",
|
424 |
"def save_settings():\n",
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
@@ -17,12 +17,15 @@
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
|
|
|
|
20 |
"import os\n",
|
21 |
"import re\n",
|
22 |
"import sys\n",
|
23 |
"import time\n",
|
24 |
"import json\n",
|
25 |
"import shutil\n",
|
|
|
26 |
"import subprocess\n",
|
27 |
"from datetime import timedelta\n",
|
28 |
"from subprocess import getoutput\n",
|
@@ -113,7 +116,7 @@
|
|
113 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
114 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
115 |
" 'ngrok_token' 'commandline_arguments',\n",
|
116 |
-
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'\n",
|
117 |
"]\n",
|
118 |
"\n",
|
119 |
"locals().update({key: settings.get(key) for key in variables})\n",
|
@@ -416,6 +419,58 @@
|
|
416 |
"\n",
|
417 |
" url += f\"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, \"\n",
|
418 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
"urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]\n",
|
420 |
"\n",
|
421 |
"for i, prefix in enumerate(prefixes):\n",
|
@@ -478,6 +533,20 @@
|
|
478 |
" !find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'\n",
|
479 |
"\n",
|
480 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
"# === ONLY SAGEMAKER ===\n",
|
482 |
"if env == \"SageMaker Studio Lab\":\n",
|
483 |
" with capture.capture_output() as cap:\n",
|
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
20 |
+
"##~ DOWNLOADING CODE | BY: ANXETY ~##\n",
|
21 |
+
"\n",
|
22 |
"import os\n",
|
23 |
"import re\n",
|
24 |
"import sys\n",
|
25 |
"import time\n",
|
26 |
"import json\n",
|
27 |
"import shutil\n",
|
28 |
+
"import requests\n",
|
29 |
"import subprocess\n",
|
30 |
"from datetime import timedelta\n",
|
31 |
"from subprocess import getoutput\n",
|
|
|
116 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
117 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
118 |
" 'ngrok_token' 'commandline_arguments',\n",
|
119 |
+
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'\n",
|
120 |
"]\n",
|
121 |
"\n",
|
122 |
"locals().update({key: settings.get(key) for key in variables})\n",
|
|
|
419 |
"\n",
|
420 |
" url += f\"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, \"\n",
|
421 |
"\n",
|
422 |
+
"def process_file_download(file_url):\n",
|
423 |
+
" global Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url\n",
|
424 |
+
"\n",
|
425 |
+
" tags = ['model', 'vae', 'embed', 'lora', 'extension']\n",
|
426 |
+
" current_tag = None\n",
|
427 |
+
"\n",
|
428 |
+
" if file_url.startswith(\"http\"):\n",
|
429 |
+
" if \"blob\" in file_url:\n",
|
430 |
+
" file_url = file_url.replace(\"blob\", \"raw\")\n",
|
431 |
+
"\n",
|
432 |
+
" response = requests.get(file_url)\n",
|
433 |
+
" lines = response.text.split('\\n')\n",
|
434 |
+
" else:\n",
|
435 |
+
" with open(file_url, 'r') as file:\n",
|
436 |
+
" lines = file.readlines()\n",
|
437 |
+
"\n",
|
438 |
+
" for line in lines:\n",
|
439 |
+
" if not line.strip():\n",
|
440 |
+
" continue\n",
|
441 |
+
"\n",
|
442 |
+
" if line.strip().startswith('#'):\n",
|
443 |
+
" current_tag = next((tag for tag in tags if tag in line.lower()), None)\n",
|
444 |
+
" elif current_tag:\n",
|
445 |
+
" urls = [url.strip() for url in line.split()]\n",
|
446 |
+
" for url in urls:\n",
|
447 |
+
" if url and (url.startswith(\"http\") or url.startswith(\"https\")):\n",
|
448 |
+
" if current_tag == 'model':\n",
|
449 |
+
" Model_url += \", \" + url\n",
|
450 |
+
" elif current_tag == 'vae':\n",
|
451 |
+
" Vae_url += \", \" + url\n",
|
452 |
+
" elif current_tag == 'embed':\n",
|
453 |
+
" Embedding_url += \", \" + url\n",
|
454 |
+
" elif current_tag == 'lora':\n",
|
455 |
+
" LoRA_url += \", \" + url\n",
|
456 |
+
" elif current_tag == 'extension':\n",
|
457 |
+
" Extensions_url += \", \" + url\n",
|
458 |
+
"\n",
|
459 |
+
"# fix all possible errors/options and function call\n",
|
460 |
+
"if custom_file_urls:\n",
|
461 |
+
" if not custom_file_urls.endswith('.txt'):\n",
|
462 |
+
" custom_file_urls += '.txt'\n",
|
463 |
+
" if not custom_file_urls.startswith('http'):\n",
|
464 |
+
" if not custom_file_urls.startswith(root_path):\n",
|
465 |
+
" custom_file_urls = f'{root_path}/{custom_file_urls}'\n",
|
466 |
+
" if custom_file_urls.count('/content') >= 2:\n",
|
467 |
+
" custom_file_urls = re.sub(r'(/content){2,}', '/content', custom_file_urls)\n",
|
468 |
+
"\n",
|
469 |
+
" try:\n",
|
470 |
+
" process_file_download(custom_file_urls)\n",
|
471 |
+
" except FileNotFoundError:\n",
|
472 |
+
" pass\n",
|
473 |
+
"\n",
|
474 |
"urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]\n",
|
475 |
"\n",
|
476 |
"for i, prefix in enumerate(prefixes):\n",
|
|
|
533 |
" !find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'\n",
|
534 |
"\n",
|
535 |
"\n",
|
536 |
+
"# === OTHER ===\n",
|
537 |
+
"# Downlaod discord tags UmiWildcards\n",
|
538 |
+
"files_umi = [\n",
|
539 |
+
" \"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/200_pan_gen.txt\",\n",
|
540 |
+
" \"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/150_bra_gen.txt\"\n",
|
541 |
+
"]\n",
|
542 |
+
"save_dir_path = f\"{webui_path}/extensions/Umi-AI-Wildcards/wildcards/discord\"\n",
|
543 |
+
"\n",
|
544 |
+
"with capture.capture_output() as cap:\n",
|
545 |
+
" for file in files_umi:\n",
|
546 |
+
" !aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}\n",
|
547 |
+
"del cap\n",
|
548 |
+
"\n",
|
549 |
+
"\n",
|
550 |
"# === ONLY SAGEMAKER ===\n",
|
551 |
"if env == \"SageMaker Studio Lab\":\n",
|
552 |
" with capture.capture_output() as cap:\n",
|
files_cells/notebooks/ru/widgets_ru.ipynb
CHANGED
@@ -17,6 +17,8 @@
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
|
|
|
|
20 |
"import os\n",
|
21 |
"import sys\n",
|
22 |
"import json\n",
|
@@ -41,14 +43,9 @@
|
|
41 |
"\n",
|
42 |
"env, root_path = detect_environment()\n",
|
43 |
"webui_path = f\"{root_path}/sdw\"\n",
|
44 |
-
"# ----------------------------------------------\n",
|
45 |
"\n",
|
46 |
"!mkdir -p {root_path}\n",
|
47 |
-
"
|
48 |
-
"\n",
|
49 |
-
"style = {'description_width': 'initial'}\n",
|
50 |
-
"layout = widgets.Layout(min_width='1047px')\n",
|
51 |
-
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
52 |
"\n",
|
53 |
"\n",
|
54 |
"# ==================== CSS JS ====================\n",
|
@@ -104,7 +101,7 @@
|
|
104 |
"}\n",
|
105 |
"\n",
|
106 |
".container_custom_downlad.expanded {\n",
|
107 |
-
" height:
|
108 |
"}\n",
|
109 |
"\n",
|
110 |
"\n",
|
@@ -304,6 +301,12 @@
|
|
304 |
"\n",
|
305 |
"\n",
|
306 |
"# ==================== WIDGETS ====================\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
307 |
"# --- MODEL ---\n",
|
308 |
"model_header = widgets.HTML('<div class=\"header\">Выбор Модели<div>')\n",
|
309 |
"model_options = ['none',\n",
|
@@ -359,7 +362,9 @@
|
|
359 |
"commandline_arguments_options = \"--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers\"\n",
|
360 |
"commandline_arguments_widget = widgets.Text(description='Аргументы:', value=commandline_arguments_options, style=style, layout=layout)\n",
|
361 |
"\n",
|
362 |
-
"display(widgets.VBox([
|
|
|
|
|
363 |
"\n",
|
364 |
"# --- CUSTOM DOWNLOAD ---\n",
|
365 |
"custom_download_header_popup = widgets.HTML('''\n",
|
@@ -393,8 +398,11 @@
|
|
393 |
"LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)\n",
|
394 |
"Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)\n",
|
395 |
"Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)\n",
|
|
|
396 |
"\n",
|
397 |
-
"display(widgets.VBox([
|
|
|
|
|
398 |
"\n",
|
399 |
"# --- Save Button ---\n",
|
400 |
"save_button = widgets.Button(description='Сохранить').add_class(\"button_save\")\n",
|
@@ -402,13 +410,15 @@
|
|
402 |
"\n",
|
403 |
"\n",
|
404 |
"# ============ Load / Save - Settings V2 ============\n",
|
|
|
|
|
405 |
"settings_keys = [\n",
|
406 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
407 |
" 'Vae', 'Vae_Num',\n",
|
408 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
409 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
410 |
" 'ngrok_token', 'commandline_arguments',\n",
|
411 |
-
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'\n",
|
412 |
"]\n",
|
413 |
"\n",
|
414 |
"def save_settings():\n",
|
|
|
17 |
{
|
18 |
"cell_type": "code",
|
19 |
"source": [
|
20 |
+
"##~ WIDGET CODE | BY: ANXETY ~##\n",
|
21 |
+
"\n",
|
22 |
"import os\n",
|
23 |
"import sys\n",
|
24 |
"import json\n",
|
|
|
43 |
"\n",
|
44 |
"env, root_path = detect_environment()\n",
|
45 |
"webui_path = f\"{root_path}/sdw\"\n",
|
|
|
46 |
"\n",
|
47 |
"!mkdir -p {root_path}\n",
|
48 |
+
"# ----------------------------------------------\n",
|
|
|
|
|
|
|
|
|
49 |
"\n",
|
50 |
"\n",
|
51 |
"# ==================== CSS JS ====================\n",
|
|
|
101 |
"}\n",
|
102 |
"\n",
|
103 |
".container_custom_downlad.expanded {\n",
|
104 |
+
" height: 270px;\n",
|
105 |
"}\n",
|
106 |
"\n",
|
107 |
"\n",
|
|
|
301 |
"\n",
|
302 |
"\n",
|
303 |
"# ==================== WIDGETS ====================\n",
|
304 |
+
"# --- global widgets ---\n",
|
305 |
+
"style = {'description_width': 'initial'}\n",
|
306 |
+
"layout = widgets.Layout(min_width='1047px')\n",
|
307 |
+
"\n",
|
308 |
+
"HR = widgets.HTML('<hr>')\n",
|
309 |
+
"\n",
|
310 |
"# --- MODEL ---\n",
|
311 |
"model_header = widgets.HTML('<div class=\"header\">Выбор Модели<div>')\n",
|
312 |
"model_options = ['none',\n",
|
|
|
362 |
"commandline_arguments_options = \"--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers\"\n",
|
363 |
"commandline_arguments_widget = widgets.Text(description='Аргументы:', value=commandline_arguments_options, style=style, layout=layout)\n",
|
364 |
"\n",
|
365 |
+
"display(widgets.VBox([\n",
|
366 |
+
" additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, HR, commandline_arguments_widget\n",
|
367 |
+
" ]).add_class(\"container\"))\n",
|
368 |
"\n",
|
369 |
"# --- CUSTOM DOWNLOAD ---\n",
|
370 |
"custom_download_header_popup = widgets.HTML('''\n",
|
|
|
398 |
"LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)\n",
|
399 |
"Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)\n",
|
400 |
"Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)\n",
|
401 |
+
"custom_file_urls_widget = widgets.Text(description='Файл (txt):', style=style, layout=layout)\n",
|
402 |
"\n",
|
403 |
+
"display(widgets.VBox([\n",
|
404 |
+
" custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget\n",
|
405 |
+
" ]).add_class(\"container\").add_class(\"container_custom_downlad\"))\n",
|
406 |
"\n",
|
407 |
"# --- Save Button ---\n",
|
408 |
"save_button = widgets.Button(description='Сохранить').add_class(\"button_save\")\n",
|
|
|
410 |
"\n",
|
411 |
"\n",
|
412 |
"# ============ Load / Save - Settings V2 ============\n",
|
413 |
+
"SETTINGS_FILE = f'{root_path}/settings.json'\n",
|
414 |
+
"\n",
|
415 |
"settings_keys = [\n",
|
416 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
417 |
" 'Vae', 'Vae_Num',\n",
|
418 |
" 'latest_webui', 'latest_exstensions', 'detailed_download',\n",
|
419 |
" 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',\n",
|
420 |
" 'ngrok_token', 'commandline_arguments',\n",
|
421 |
+
" 'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'\n",
|
422 |
"]\n",
|
423 |
"\n",
|
424 |
"def save_settings():\n",
|
files_cells/python/en/downloading_en.py
CHANGED
@@ -4,12 +4,15 @@
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
|
|
|
|
7 |
import os
|
8 |
import re
|
9 |
import sys
|
10 |
import time
|
11 |
import json
|
12 |
import shutil
|
|
|
13 |
import subprocess
|
14 |
from datetime import timedelta
|
15 |
from subprocess import getoutput
|
@@ -100,7 +103,7 @@ variables = [
|
|
100 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
101 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
102 |
'ngrok_token' 'commandline_arguments',
|
103 |
-
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'
|
104 |
]
|
105 |
|
106 |
locals().update({key: settings.get(key) for key in variables})
|
@@ -403,6 +406,58 @@ for submodel in submodels:
|
|
403 |
|
404 |
url += f"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, "
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]
|
407 |
|
408 |
for i, prefix in enumerate(prefixes):
|
@@ -462,6 +517,20 @@ if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir))
|
|
462 |
get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
|
463 |
|
464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
# === ONLY SAGEMAKER ===
|
466 |
if env == "SageMaker Studio Lab":
|
467 |
with capture.capture_output() as cap:
|
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
7 |
+
##~ DOWNLOADING CODE | BY: ANXETY ~##
|
8 |
+
|
9 |
import os
|
10 |
import re
|
11 |
import sys
|
12 |
import time
|
13 |
import json
|
14 |
import shutil
|
15 |
+
import requests
|
16 |
import subprocess
|
17 |
from datetime import timedelta
|
18 |
from subprocess import getoutput
|
|
|
103 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
104 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
105 |
'ngrok_token' 'commandline_arguments',
|
106 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'
|
107 |
]
|
108 |
|
109 |
locals().update({key: settings.get(key) for key in variables})
|
|
|
406 |
|
407 |
url += f"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, "
|
408 |
|
409 |
+
def process_file_download(file_url):
|
410 |
+
global Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url
|
411 |
+
|
412 |
+
tags = ['model', 'vae', 'embed', 'lora', 'extension']
|
413 |
+
current_tag = None
|
414 |
+
|
415 |
+
if file_url.startswith("http"):
|
416 |
+
if "blob" in file_url:
|
417 |
+
file_url = file_url.replace("blob", "raw")
|
418 |
+
|
419 |
+
response = requests.get(file_url)
|
420 |
+
lines = response.text.split('\n')
|
421 |
+
else:
|
422 |
+
with open(file_url, 'r') as file:
|
423 |
+
lines = file.readlines()
|
424 |
+
|
425 |
+
for line in lines:
|
426 |
+
if not line.strip():
|
427 |
+
continue
|
428 |
+
|
429 |
+
if line.strip().startswith('#'):
|
430 |
+
current_tag = next((tag for tag in tags if tag in line.lower()), None)
|
431 |
+
elif current_tag:
|
432 |
+
urls = [url.strip() for url in line.split()]
|
433 |
+
for url in urls:
|
434 |
+
if url and (url.startswith("http") or url.startswith("https")):
|
435 |
+
if current_tag == 'model':
|
436 |
+
Model_url += ", " + url
|
437 |
+
elif current_tag == 'vae':
|
438 |
+
Vae_url += ", " + url
|
439 |
+
elif current_tag == 'embed':
|
440 |
+
Embedding_url += ", " + url
|
441 |
+
elif current_tag == 'lora':
|
442 |
+
LoRA_url += ", " + url
|
443 |
+
elif current_tag == 'extension':
|
444 |
+
Extensions_url += ", " + url
|
445 |
+
|
446 |
+
# fix all possible errors/options and function call
|
447 |
+
if custom_file_urls:
|
448 |
+
if not custom_file_urls.endswith('.txt'):
|
449 |
+
custom_file_urls += '.txt'
|
450 |
+
if not custom_file_urls.startswith('http'):
|
451 |
+
if not custom_file_urls.startswith(root_path):
|
452 |
+
custom_file_urls = f'{root_path}/{custom_file_urls}'
|
453 |
+
if custom_file_urls.count('/content') >= 2:
|
454 |
+
custom_file_urls = re.sub(r'(/content){2,}', '/content', custom_file_urls)
|
455 |
+
|
456 |
+
try:
|
457 |
+
process_file_download(custom_file_urls)
|
458 |
+
except FileNotFoundError:
|
459 |
+
pass
|
460 |
+
|
461 |
urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]
|
462 |
|
463 |
for i, prefix in enumerate(prefixes):
|
|
|
517 |
get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
|
518 |
|
519 |
|
520 |
+
# === OTHER ===
|
521 |
+
# Downlaod discord tags UmiWildcards
|
522 |
+
files_umi = [
|
523 |
+
"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/200_pan_gen.txt",
|
524 |
+
"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/150_bra_gen.txt"
|
525 |
+
]
|
526 |
+
save_dir_path = f"{webui_path}/extensions/Umi-AI-Wildcards/wildcards/discord"
|
527 |
+
|
528 |
+
with capture.capture_output() as cap:
|
529 |
+
for file in files_umi:
|
530 |
+
get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
|
531 |
+
del cap
|
532 |
+
|
533 |
+
|
534 |
# === ONLY SAGEMAKER ===
|
535 |
if env == "SageMaker Studio Lab":
|
536 |
with capture.capture_output() as cap:
|
files_cells/python/en/widgets_en.py
CHANGED
@@ -4,6 +4,8 @@
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
|
|
|
|
7 |
import os
|
8 |
import sys
|
9 |
import json
|
@@ -28,14 +30,9 @@ def detect_environment():
|
|
28 |
|
29 |
env, root_path = detect_environment()
|
30 |
webui_path = f"{root_path}/sdw"
|
31 |
-
# ----------------------------------------------
|
32 |
|
33 |
get_ipython().system('mkdir -p {root_path}')
|
34 |
-
|
35 |
-
|
36 |
-
style = {'description_width': 'initial'}
|
37 |
-
layout = widgets.Layout(min_width='1047px')
|
38 |
-
SETTINGS_FILE = f'{root_path}/settings.json'
|
39 |
|
40 |
|
41 |
# ==================== CSS JS ====================
|
@@ -91,7 +88,7 @@ hr {
|
|
91 |
}
|
92 |
|
93 |
.container_custom_downlad.expanded {
|
94 |
-
height:
|
95 |
}
|
96 |
|
97 |
|
@@ -291,6 +288,12 @@ display(HTML(CSS))
|
|
291 |
|
292 |
|
293 |
# ==================== WIDGETS ====================
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
# --- MODEL ---
|
295 |
model_header = widgets.HTML('<div class="header">Model Selection<div>')
|
296 |
model_options = ['none',
|
@@ -346,7 +349,9 @@ ngrok_widget = widgets.HBox([ngrok_token_widget, ngrock_button], style=style, la
|
|
346 |
commandline_arguments_options = "--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers"
|
347 |
commandline_arguments_widget = widgets.Text(description='Arguments:', value=commandline_arguments_options, style=style, layout=layout)
|
348 |
|
349 |
-
display(widgets.VBox([
|
|
|
|
|
350 |
|
351 |
# --- CUSTOM DOWNLOAD ---
|
352 |
custom_download_header_popup = widgets.HTML('''
|
@@ -380,8 +385,11 @@ Vae_url_widget = widgets.Text(description='Vae:', style=style, layout=layout)
|
|
380 |
LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)
|
381 |
Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)
|
382 |
Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)
|
|
|
383 |
|
384 |
-
display(widgets.VBox([
|
|
|
|
|
385 |
|
386 |
# --- Save Button ---
|
387 |
save_button = widgets.Button(description='Save').add_class("button_save")
|
@@ -389,13 +397,15 @@ display(save_button)
|
|
389 |
|
390 |
|
391 |
# ============ Load / Save - Settings V2 ============
|
|
|
|
|
392 |
settings_keys = [
|
393 |
'Model', 'Model_Num', 'Inpainting_Model',
|
394 |
'Vae', 'Vae_Num',
|
395 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
396 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
397 |
'ngrok_token', 'commandline_arguments',
|
398 |
-
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'
|
399 |
]
|
400 |
|
401 |
def save_settings():
|
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
7 |
+
##~ WIDGET CODE | BY: ANXETY ~##
|
8 |
+
|
9 |
import os
|
10 |
import sys
|
11 |
import json
|
|
|
30 |
|
31 |
env, root_path = detect_environment()
|
32 |
webui_path = f"{root_path}/sdw"
|
|
|
33 |
|
34 |
get_ipython().system('mkdir -p {root_path}')
|
35 |
+
# ----------------------------------------------
|
|
|
|
|
|
|
|
|
36 |
|
37 |
|
38 |
# ==================== CSS JS ====================
|
|
|
88 |
}
|
89 |
|
90 |
.container_custom_downlad.expanded {
|
91 |
+
height: 270px;
|
92 |
}
|
93 |
|
94 |
|
|
|
288 |
|
289 |
|
290 |
# ==================== WIDGETS ====================
|
291 |
+
# --- global widgets ---
|
292 |
+
style = {'description_width': 'initial'}
|
293 |
+
layout = widgets.Layout(min_width='1047px')
|
294 |
+
|
295 |
+
HR = widgets.HTML('<hr>')
|
296 |
+
|
297 |
# --- MODEL ---
|
298 |
model_header = widgets.HTML('<div class="header">Model Selection<div>')
|
299 |
model_options = ['none',
|
|
|
349 |
commandline_arguments_options = "--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers"
|
350 |
commandline_arguments_widget = widgets.Text(description='Arguments:', value=commandline_arguments_options, style=style, layout=layout)
|
351 |
|
352 |
+
display(widgets.VBox([
|
353 |
+
additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, HR, commandline_arguments_widget
|
354 |
+
]).add_class("container"))
|
355 |
|
356 |
# --- CUSTOM DOWNLOAD ---
|
357 |
custom_download_header_popup = widgets.HTML('''
|
|
|
385 |
LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)
|
386 |
Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)
|
387 |
Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)
|
388 |
+
custom_file_urls_widget = widgets.Text(description='File (txt):', style=style, layout=layout)
|
389 |
|
390 |
+
display(widgets.VBox([
|
391 |
+
custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget
|
392 |
+
]).add_class("container").add_class("container_custom_downlad"))
|
393 |
|
394 |
# --- Save Button ---
|
395 |
save_button = widgets.Button(description='Save').add_class("button_save")
|
|
|
397 |
|
398 |
|
399 |
# ============ Load / Save - Settings V2 ============
|
400 |
+
SETTINGS_FILE = f'{root_path}/settings.json'
|
401 |
+
|
402 |
settings_keys = [
|
403 |
'Model', 'Model_Num', 'Inpainting_Model',
|
404 |
'Vae', 'Vae_Num',
|
405 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
406 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
407 |
'ngrok_token', 'commandline_arguments',
|
408 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'
|
409 |
]
|
410 |
|
411 |
def save_settings():
|
files_cells/python/ru/downloading_ru.py
CHANGED
@@ -4,12 +4,15 @@
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
|
|
|
|
7 |
import os
|
8 |
import re
|
9 |
import sys
|
10 |
import time
|
11 |
import json
|
12 |
import shutil
|
|
|
13 |
import subprocess
|
14 |
from datetime import timedelta
|
15 |
from subprocess import getoutput
|
@@ -100,7 +103,7 @@ variables = [
|
|
100 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
101 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
102 |
'ngrok_token' 'commandline_arguments',
|
103 |
-
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'
|
104 |
]
|
105 |
|
106 |
locals().update({key: settings.get(key) for key in variables})
|
@@ -403,6 +406,58 @@ for submodel in submodels:
|
|
403 |
|
404 |
url += f"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, "
|
405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
406 |
urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]
|
407 |
|
408 |
for i, prefix in enumerate(prefixes):
|
@@ -462,6 +517,20 @@ if any(not file.endswith(('.txt', '.yaml')) for file in os.listdir(control_dir))
|
|
462 |
get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
|
463 |
|
464 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
# === ONLY SAGEMAKER ===
|
466 |
if env == "SageMaker Studio Lab":
|
467 |
with capture.capture_output() as cap:
|
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
7 |
+
##~ DOWNLOADING CODE | BY: ANXETY ~##
|
8 |
+
|
9 |
import os
|
10 |
import re
|
11 |
import sys
|
12 |
import time
|
13 |
import json
|
14 |
import shutil
|
15 |
+
import requests
|
16 |
import subprocess
|
17 |
from datetime import timedelta
|
18 |
from subprocess import getoutput
|
|
|
103 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
104 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
105 |
'ngrok_token' 'commandline_arguments',
|
106 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'
|
107 |
]
|
108 |
|
109 |
locals().update({key: settings.get(key) for key in variables})
|
|
|
406 |
|
407 |
url += f"{submodel['url']} {submodel['dst_dir']} {submodel['name']}, "
|
408 |
|
409 |
+
def process_file_download(file_url):
|
410 |
+
global Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url
|
411 |
+
|
412 |
+
tags = ['model', 'vae', 'embed', 'lora', 'extension']
|
413 |
+
current_tag = None
|
414 |
+
|
415 |
+
if file_url.startswith("http"):
|
416 |
+
if "blob" in file_url:
|
417 |
+
file_url = file_url.replace("blob", "raw")
|
418 |
+
|
419 |
+
response = requests.get(file_url)
|
420 |
+
lines = response.text.split('\n')
|
421 |
+
else:
|
422 |
+
with open(file_url, 'r') as file:
|
423 |
+
lines = file.readlines()
|
424 |
+
|
425 |
+
for line in lines:
|
426 |
+
if not line.strip():
|
427 |
+
continue
|
428 |
+
|
429 |
+
if line.strip().startswith('#'):
|
430 |
+
current_tag = next((tag for tag in tags if tag in line.lower()), None)
|
431 |
+
elif current_tag:
|
432 |
+
urls = [url.strip() for url in line.split()]
|
433 |
+
for url in urls:
|
434 |
+
if url and (url.startswith("http") or url.startswith("https")):
|
435 |
+
if current_tag == 'model':
|
436 |
+
Model_url += ", " + url
|
437 |
+
elif current_tag == 'vae':
|
438 |
+
Vae_url += ", " + url
|
439 |
+
elif current_tag == 'embed':
|
440 |
+
Embedding_url += ", " + url
|
441 |
+
elif current_tag == 'lora':
|
442 |
+
LoRA_url += ", " + url
|
443 |
+
elif current_tag == 'extension':
|
444 |
+
Extensions_url += ", " + url
|
445 |
+
|
446 |
+
# fix all possible errors/options and function call
|
447 |
+
if custom_file_urls:
|
448 |
+
if not custom_file_urls.endswith('.txt'):
|
449 |
+
custom_file_urls += '.txt'
|
450 |
+
if not custom_file_urls.startswith('http'):
|
451 |
+
if not custom_file_urls.startswith(root_path):
|
452 |
+
custom_file_urls = f'{root_path}/{custom_file_urls}'
|
453 |
+
if custom_file_urls.count('/content') >= 2:
|
454 |
+
custom_file_urls = re.sub(r'(/content){2,}', '/content', custom_file_urls)
|
455 |
+
|
456 |
+
try:
|
457 |
+
process_file_download(custom_file_urls)
|
458 |
+
except FileNotFoundError:
|
459 |
+
pass
|
460 |
+
|
461 |
urls = [Model_url, Vae_url, LoRA_url, Embedding_url, Extensions_url]
|
462 |
|
463 |
for i, prefix in enumerate(prefixes):
|
|
|
517 |
get_ipython().system("find {control_dir}/ -mindepth 1 ! -name '*.yaml' -printf '%f\\n' | sed 's/^[^_]*_[^_]*_[^_]*_\\(.*\\)_fp16\\.safetensors$/\\1/'")
|
518 |
|
519 |
|
520 |
+
# === OTHER ===
|
521 |
+
# Downlaod discord tags UmiWildcards
|
522 |
+
files_umi = [
|
523 |
+
"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/200_pan_gen.txt",
|
524 |
+
"https://huggingface.co/NagisaNao/test/resolve/main/extensions/UmiWildacrd/discord/150_bra_gen.txt"
|
525 |
+
]
|
526 |
+
save_dir_path = f"{webui_path}/extensions/Umi-AI-Wildcards/wildcards/discord"
|
527 |
+
|
528 |
+
with capture.capture_output() as cap:
|
529 |
+
for file in files_umi:
|
530 |
+
get_ipython().system('aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -j5 -x16 -s16 -k1M -c -d {save_dir_path} {file}')
|
531 |
+
del cap
|
532 |
+
|
533 |
+
|
534 |
# === ONLY SAGEMAKER ===
|
535 |
if env == "SageMaker Studio Lab":
|
536 |
with capture.capture_output() as cap:
|
files_cells/python/ru/widgets_ru.py
CHANGED
@@ -4,6 +4,8 @@
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
|
|
|
|
7 |
import os
|
8 |
import sys
|
9 |
import json
|
@@ -28,14 +30,9 @@ def detect_environment():
|
|
28 |
|
29 |
env, root_path = detect_environment()
|
30 |
webui_path = f"{root_path}/sdw"
|
31 |
-
# ----------------------------------------------
|
32 |
|
33 |
get_ipython().system('mkdir -p {root_path}')
|
34 |
-
|
35 |
-
|
36 |
-
style = {'description_width': 'initial'}
|
37 |
-
layout = widgets.Layout(min_width='1047px')
|
38 |
-
SETTINGS_FILE = f'{root_path}/settings.json'
|
39 |
|
40 |
|
41 |
# ==================== CSS JS ====================
|
@@ -91,7 +88,7 @@ hr {
|
|
91 |
}
|
92 |
|
93 |
.container_custom_downlad.expanded {
|
94 |
-
height:
|
95 |
}
|
96 |
|
97 |
|
@@ -291,6 +288,12 @@ display(HTML(CSS))
|
|
291 |
|
292 |
|
293 |
# ==================== WIDGETS ====================
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
# --- MODEL ---
|
295 |
model_header = widgets.HTML('<div class="header">Выбор Модели<div>')
|
296 |
model_options = ['none',
|
@@ -346,7 +349,9 @@ ngrok_widget = widgets.HBox([ngrok_token_widget, ngrock_button], style=style, la
|
|
346 |
commandline_arguments_options = "--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers"
|
347 |
commandline_arguments_widget = widgets.Text(description='Аргументы:', value=commandline_arguments_options, style=style, layout=layout)
|
348 |
|
349 |
-
display(widgets.VBox([
|
|
|
|
|
350 |
|
351 |
# --- CUSTOM DOWNLOAD ---
|
352 |
custom_download_header_popup = widgets.HTML('''
|
@@ -380,8 +385,11 @@ Vae_url_widget = widgets.Text(description='Vae:', style=style, layout=layout)
|
|
380 |
LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)
|
381 |
Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)
|
382 |
Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)
|
|
|
383 |
|
384 |
-
display(widgets.VBox([
|
|
|
|
|
385 |
|
386 |
# --- Save Button ---
|
387 |
save_button = widgets.Button(description='Сохранить').add_class("button_save")
|
@@ -389,13 +397,15 @@ display(save_button)
|
|
389 |
|
390 |
|
391 |
# ============ Load / Save - Settings V2 ============
|
|
|
|
|
392 |
settings_keys = [
|
393 |
'Model', 'Model_Num', 'Inpainting_Model',
|
394 |
'Vae', 'Vae_Num',
|
395 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
396 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
397 |
'ngrok_token', 'commandline_arguments',
|
398 |
-
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url'
|
399 |
]
|
400 |
|
401 |
def save_settings():
|
|
|
4 |
# In[ ]:
|
5 |
|
6 |
|
7 |
+
##~ WIDGET CODE | BY: ANXETY ~##
|
8 |
+
|
9 |
import os
|
10 |
import sys
|
11 |
import json
|
|
|
30 |
|
31 |
env, root_path = detect_environment()
|
32 |
webui_path = f"{root_path}/sdw"
|
|
|
33 |
|
34 |
get_ipython().system('mkdir -p {root_path}')
|
35 |
+
# ----------------------------------------------
|
|
|
|
|
|
|
|
|
36 |
|
37 |
|
38 |
# ==================== CSS JS ====================
|
|
|
88 |
}
|
89 |
|
90 |
.container_custom_downlad.expanded {
|
91 |
+
height: 270px;
|
92 |
}
|
93 |
|
94 |
|
|
|
288 |
|
289 |
|
290 |
# ==================== WIDGETS ====================
|
291 |
+
# --- global widgets ---
|
292 |
+
style = {'description_width': 'initial'}
|
293 |
+
layout = widgets.Layout(min_width='1047px')
|
294 |
+
|
295 |
+
HR = widgets.HTML('<hr>')
|
296 |
+
|
297 |
# --- MODEL ---
|
298 |
model_header = widgets.HTML('<div class="header">Выбор Модели<div>')
|
299 |
model_options = ['none',
|
|
|
349 |
commandline_arguments_options = "--listen --enable-insecure-extension-access --theme dark --no-half-vae --disable-console-progressbars --xformers"
|
350 |
commandline_arguments_widget = widgets.Text(description='Аргументы:', value=commandline_arguments_options, style=style, layout=layout)
|
351 |
|
352 |
+
display(widgets.VBox([
|
353 |
+
additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, HR, commandline_arguments_widget
|
354 |
+
]).add_class("container"))
|
355 |
|
356 |
# --- CUSTOM DOWNLOAD ---
|
357 |
custom_download_header_popup = widgets.HTML('''
|
|
|
385 |
LoRA_url_widget = widgets.Text(description='LoRa:', style=style, layout=layout)
|
386 |
Embedding_url_widget = widgets.Text(description='Embedding:', style=style, layout=layout)
|
387 |
Extensions_url_widget = widgets.Text(description='Extensions:', style=style, layout=layout)
|
388 |
+
custom_file_urls_widget = widgets.Text(description='Файл (txt):', style=style, layout=layout)
|
389 |
|
390 |
+
display(widgets.VBox([
|
391 |
+
custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget
|
392 |
+
]).add_class("container").add_class("container_custom_downlad"))
|
393 |
|
394 |
# --- Save Button ---
|
395 |
save_button = widgets.Button(description='Сохранить').add_class("button_save")
|
|
|
397 |
|
398 |
|
399 |
# ============ Load / Save - Settings V2 ============
|
400 |
+
SETTINGS_FILE = f'{root_path}/settings.json'
|
401 |
+
|
402 |
settings_keys = [
|
403 |
'Model', 'Model_Num', 'Inpainting_Model',
|
404 |
'Vae', 'Vae_Num',
|
405 |
'latest_webui', 'latest_exstensions', 'detailed_download',
|
406 |
'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token',
|
407 |
'ngrok_token', 'commandline_arguments',
|
408 |
+
'Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls'
|
409 |
]
|
410 |
|
411 |
def save_settings():
|