new save settings method test 2
Browse files- files_cells/notebooks/en/downloading_en.ipynb +10 -4
- files_cells/notebooks/en/widgets_en.ipynb +103 -22
- files_cells/notebooks/ru/downloading_ru.ipynb +10 -4
- files_cells/notebooks/ru/widgets_ru.ipynb +5 -1
- files_cells/python/en/downloading_en.py +10 -4
- files_cells/python/en/widgets_en.py +103 -22
- files_cells/python/ru/downloading_ru.py +10 -4
- files_cells/python/ru/widgets_ru.py +5 -1
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
@@ -100,14 +100,20 @@
|
|
100 |
" clear_output()\n",
|
101 |
"\n",
|
102 |
"\n",
|
103 |
-
"# ================= loading settings
|
|
|
|
|
104 |
"def load_settings(path):\n",
|
105 |
" if os.path.exists(path):\n",
|
106 |
" with open(path, 'r') as file:\n",
|
107 |
-
"
|
|
|
|
|
|
|
|
|
108 |
" return {}\n",
|
109 |
"\n",
|
110 |
-
"settings = load_settings(f'{root_path}/settings.
|
111 |
"\n",
|
112 |
"variables = [\n",
|
113 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
@@ -505,7 +511,7 @@
|
|
505 |
"\n",
|
506 |
"\n",
|
507 |
"# Cleaning shit after downloading...\n",
|
508 |
-
"!find
|
509 |
"\n",
|
510 |
"\n",
|
511 |
"## Install of Custom extensions\n",
|
|
|
100 |
" clear_output()\n",
|
101 |
"\n",
|
102 |
"\n",
|
103 |
+
"# ================= loading settings V5 =================\n",
|
104 |
+
"import toml\n",
|
105 |
+
"\n",
|
106 |
"def load_settings(path):\n",
|
107 |
" if os.path.exists(path):\n",
|
108 |
" with open(path, 'r') as file:\n",
|
109 |
+
" settings = toml.load(file)\n",
|
110 |
+
" flat_settings = {}\n",
|
111 |
+
" for section, keys in settings.items():\n",
|
112 |
+
" flat_settings.update(keys)\n",
|
113 |
+
" return flat_settings\n",
|
114 |
" return {}\n",
|
115 |
"\n",
|
116 |
+
"settings = load_settings(f'{root_path}/settings.toml')\n",
|
117 |
"\n",
|
118 |
"variables = [\n",
|
119 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
|
|
511 |
"\n",
|
512 |
"\n",
|
513 |
"# Cleaning shit after downloading...\n",
|
514 |
+
"!find {webui_path} \\( -type d \\( -name \".ipynb_checkpoints\" -o -name \".aria2\" \\) -o -type f -name \"*.aria2\" \\) -exec rm -r {{}} \\; >/dev/null 2>&1\n",
|
515 |
"\n",
|
516 |
"\n",
|
517 |
"## Install of Custom extensions\n",
|
files_cells/notebooks/en/widgets_en.ipynb
CHANGED
@@ -47,6 +47,49 @@
|
|
47 |
"\n",
|
48 |
"\n",
|
49 |
"# ==================== CSS JS ====================\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
"CSS = '''\n",
|
51 |
"<style>\n",
|
52 |
"/* General Styles */\n",
|
@@ -78,7 +121,7 @@
|
|
78 |
" border-radius: 15px;\n",
|
79 |
" box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);\n",
|
80 |
" margin-bottom: 5px;\n",
|
81 |
-
" overflow:
|
82 |
"}\n",
|
83 |
"\n",
|
84 |
".container::after {\n",
|
@@ -91,9 +134,38 @@
|
|
91 |
" color: rgba(0, 0, 0, 0.15);\n",
|
92 |
"}\n",
|
93 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
".container_custom_downlad {\n",
|
95 |
" height: 55px;\n",
|
96 |
-
" overflow: hidden;\n",
|
97 |
" transition: all 0.5s;\n",
|
98 |
"}\n",
|
99 |
"\n",
|
@@ -123,7 +195,7 @@
|
|
123 |
"\n",
|
124 |
"\n",
|
125 |
"/* Input field styles */\n",
|
126 |
-
"
|
127 |
".widget-dropdown select,\n",
|
128 |
".widget-text input[type=\"text\"] {\n",
|
129 |
" height: 30px;\n",
|
@@ -133,6 +205,7 @@
|
|
133 |
" box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);\n",
|
134 |
" transition: all 0.3s ease-in-out;\n",
|
135 |
"}\n",
|
|
|
136 |
"\n",
|
137 |
".widget-dropdown select:focus,\n",
|
138 |
".widget-text input[type=\"text\"]:focus {\n",
|
@@ -320,7 +393,7 @@
|
|
320 |
"Model_Num_widget = widgets.Text(description='Model Number:', placeholder='Enter the model numbers to be downloaded using comma/space.', style=style, layout=layout)\n",
|
321 |
"Inpainting_Model_widget = widgets.Checkbox(value=False, description='Inpainting Models', style=style)\n",
|
322 |
"\n",
|
323 |
-
"display(widgets.VBox([model_header, Model_widget, Model_Num_widget, Inpainting_Model_widget]).add_class(\"container\"))\n",
|
324 |
"\n",
|
325 |
"# --- VAE ---\n",
|
326 |
"vae_header = widgets.HTML('<div class=\"header\" >VAE Selection</div>')\n",
|
@@ -333,7 +406,7 @@
|
|
333 |
"Vae_widget = widgets.Dropdown(options=vae_options, value='3.Blessed2.vae', description='Vae:', style=style, layout=layout)\n",
|
334 |
"Vae_Num_widget = widgets.Text(description='Vae number:', placeholder='Enter the vae numbers to be downloaded using comma/space.', style=style, layout=layout)\n",
|
335 |
"\n",
|
336 |
-
"display(widgets.VBox([vae_header, Vae_widget, Vae_Num_widget]).add_class(\"container\"))\n",
|
337 |
"\n",
|
338 |
"# --- ADDITIONAL ---\n",
|
339 |
"additional_header = widgets.HTML('<div class=\"header\">Additional</div>')\n",
|
@@ -363,7 +436,7 @@
|
|
363 |
"additional_widget_list = [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",
|
364 |
"if free_plan and env == \"Google Colab\":\n",
|
365 |
" additional_widget_list.remove(ngrok_widget)\n",
|
366 |
-
"display(widgets.VBox(additional_widget_list).add_class(\"container\"))\n",
|
367 |
"\n",
|
368 |
"# --- CUSTOM DOWNLOAD ---\n",
|
369 |
"custom_download_header_popup = widgets.HTML('''\n",
|
@@ -401,7 +474,7 @@
|
|
401 |
"\n",
|
402 |
"display(widgets.VBox([\n",
|
403 |
" custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget\n",
|
404 |
-
" ]).add_class(\"container\").add_class(\"container_custom_downlad\"))\n",
|
405 |
"\n",
|
406 |
"# --- Save Button ---\n",
|
407 |
"save_button = widgets.Button(description='Save').add_class(\"button_save\")\n",
|
@@ -409,28 +482,36 @@
|
|
409 |
"\n",
|
410 |
"\n",
|
411 |
"# ============ Load / Save - Settings V2 ============\n",
|
412 |
-
"
|
413 |
-
"\n",
|
414 |
-
"
|
415 |
-
"
|
416 |
-
"
|
417 |
-
"
|
418 |
-
"
|
419 |
-
"
|
420 |
-
"
|
421 |
-
"]
|
|
|
|
|
|
|
|
|
422 |
"\n",
|
423 |
"def save_settings():\n",
|
424 |
-
" settings = {
|
|
|
|
|
425 |
" with open(SETTINGS_FILE, 'w') as f:\n",
|
426 |
-
"
|
427 |
"\n",
|
428 |
"def load_settings():\n",
|
429 |
" if os.path.exists(SETTINGS_FILE):\n",
|
430 |
" with open(SETTINGS_FILE, 'r') as f:\n",
|
431 |
-
"
|
432 |
-
" for
|
433 |
-
"
|
|
|
|
|
434 |
"\n",
|
435 |
"def save_data(button):\n",
|
436 |
" save_settings()\n",
|
|
|
47 |
"\n",
|
48 |
"\n",
|
49 |
"# ==================== CSS JS ====================\n",
|
50 |
+
"# custom background images (test)\n",
|
51 |
+
"import argparse\n",
|
52 |
+
"parser = argparse.ArgumentParser(description='This script processes an background image.')\n",
|
53 |
+
"parser.add_argument('-i', '--image', type=str, help='URL of the image to process', metavar='')\n",
|
54 |
+
"parser.add_argument('-o', '--opacity', type=float, help='Opacity level for the image, between 0 and 1', metavar='', default=0.3)\n",
|
55 |
+
"parser.add_argument('-b', '--blur', type=str, help='Blur level for the image', metavar='', default=0)\n",
|
56 |
+
"parser.add_argument('-y', type=int, help='Y coordinate for the image in px', metavar='', default=0)\n",
|
57 |
+
"parser.add_argument('-x', type=int, help='X coordinate for the image in px', metavar='', default=0)\n",
|
58 |
+
"parser.add_argument('-s', '--scale', type=int, help='Scale image in %%', metavar='', default=100)\n",
|
59 |
+
"parser.add_argument('-m', '--mode', type=str, help='Specify \"no-repeat\" so that the image pattern is not repeated.', metavar='', default='repeat')\n",
|
60 |
+
"parser.add_argument('-t', '--transparent', action='store_true', help='Flag to exclude z-index from CSS. Makes fields transparent')\n",
|
61 |
+
"args = parser.parse_args()\n",
|
62 |
+
"# ---\n",
|
63 |
+
"url_img, opacity_img, blur_img, y_img, x_img, scale_img, mode_img = args.image, args.opacity, args.blur, args.y, args.x, args.scale, args.mode\n",
|
64 |
+
"\n",
|
65 |
+
"container_background = f'''\n",
|
66 |
+
"<style>\n",
|
67 |
+
":root {{\n",
|
68 |
+
" --img_background: url({url_img});\n",
|
69 |
+
" --img_opacity: {opacity_img};\n",
|
70 |
+
" --img_blur: {blur_img}px;\n",
|
71 |
+
" --image_y: {y_img}px;\n",
|
72 |
+
" --image_x: {x_img}px;\n",
|
73 |
+
" --img_scale: {scale_img}%;\n",
|
74 |
+
" --img_mode: {mode_img};\n",
|
75 |
+
"}}\n",
|
76 |
+
"\n",
|
77 |
+
".widget-dropdown select,\n",
|
78 |
+
".widget-text input[type=\"text\"] {{\n",
|
79 |
+
" height: 30px;\n",
|
80 |
+
" background-color: #1c1c1c;\n",
|
81 |
+
" border: 1px solid #262626;\n",
|
82 |
+
" border-radius: 10px;\n",
|
83 |
+
" box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);\n",
|
84 |
+
" transition: all 0.3s ease-in-out;\n",
|
85 |
+
"'''\n",
|
86 |
+
"\n",
|
87 |
+
"if not args.transparent:\n",
|
88 |
+
" container_background += \" z-index: 1;\\n</style>\\n\"\n",
|
89 |
+
"\n",
|
90 |
+
"display(HTML(container_background))\n",
|
91 |
+
"# ---\n",
|
92 |
+
"\n",
|
93 |
"CSS = '''\n",
|
94 |
"<style>\n",
|
95 |
"/* General Styles */\n",
|
|
|
121 |
" border-radius: 15px;\n",
|
122 |
" box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);\n",
|
123 |
" margin-bottom: 5px;\n",
|
124 |
+
" overflow: hidden;\n",
|
125 |
"}\n",
|
126 |
"\n",
|
127 |
".container::after {\n",
|
|
|
134 |
" color: rgba(0, 0, 0, 0.15);\n",
|
135 |
"}\n",
|
136 |
"\n",
|
137 |
+
"/* background img */\n",
|
138 |
+
".container::before {\n",
|
139 |
+
" content: \"\";\n",
|
140 |
+
" position: absolute;\n",
|
141 |
+
" top: 0;\n",
|
142 |
+
" left: 0;\n",
|
143 |
+
" right: 0;\n",
|
144 |
+
" bottom: 0;\n",
|
145 |
+
" background-image: var(--img_background);\n",
|
146 |
+
" background-size: var(--img_scale);\n",
|
147 |
+
" background-repeat: var(--img_mode);\n",
|
148 |
+
" opacity: var(--img_opacity);\n",
|
149 |
+
" mix-blend-mode: screen;\n",
|
150 |
+
" pointer-events: none;\n",
|
151 |
+
" filter: blur(var(--img_blur));\n",
|
152 |
+
"}\n",
|
153 |
+
"\n",
|
154 |
+
".image_1::before {\n",
|
155 |
+
" background-position: var(--image_x) calc(-120px - var(--image_y));\n",
|
156 |
+
"}\n",
|
157 |
+
".image_2::before {\n",
|
158 |
+
" background-position: var(--image_x) calc(-290px - var(--image_y));\n",
|
159 |
+
"}\n",
|
160 |
+
".image_3::before {\n",
|
161 |
+
" background-position: var(--image_x) calc(-430px - var(--image_y));\n",
|
162 |
+
"}\n",
|
163 |
+
".image_4::before {\n",
|
164 |
+
" background-position: var(--image_x) calc(-740px - var(--image_y));\n",
|
165 |
+
"}\n",
|
166 |
+
"\n",
|
167 |
".container_custom_downlad {\n",
|
168 |
" height: 55px;\n",
|
|
|
169 |
" transition: all 0.5s;\n",
|
170 |
"}\n",
|
171 |
"\n",
|
|
|
195 |
"\n",
|
196 |
"\n",
|
197 |
"/* Input field styles */\n",
|
198 |
+
"/*\n",
|
199 |
".widget-dropdown select,\n",
|
200 |
".widget-text input[type=\"text\"] {\n",
|
201 |
" height: 30px;\n",
|
|
|
205 |
" box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);\n",
|
206 |
" transition: all 0.3s ease-in-out;\n",
|
207 |
"}\n",
|
208 |
+
"*/\n",
|
209 |
"\n",
|
210 |
".widget-dropdown select:focus,\n",
|
211 |
".widget-text input[type=\"text\"]:focus {\n",
|
|
|
393 |
"Model_Num_widget = widgets.Text(description='Model Number:', placeholder='Enter the model numbers to be downloaded using comma/space.', style=style, layout=layout)\n",
|
394 |
"Inpainting_Model_widget = widgets.Checkbox(value=False, description='Inpainting Models', style=style)\n",
|
395 |
"\n",
|
396 |
+
"display(widgets.VBox([model_header, Model_widget, Model_Num_widget, Inpainting_Model_widget]).add_class(\"container\").add_class(\"image_1\"))\n",
|
397 |
"\n",
|
398 |
"# --- VAE ---\n",
|
399 |
"vae_header = widgets.HTML('<div class=\"header\" >VAE Selection</div>')\n",
|
|
|
406 |
"Vae_widget = widgets.Dropdown(options=vae_options, value='3.Blessed2.vae', description='Vae:', style=style, layout=layout)\n",
|
407 |
"Vae_Num_widget = widgets.Text(description='Vae number:', placeholder='Enter the vae numbers to be downloaded using comma/space.', style=style, layout=layout)\n",
|
408 |
"\n",
|
409 |
+
"display(widgets.VBox([vae_header, Vae_widget, Vae_Num_widget]).add_class(\"container\").add_class(\"image_2\"))\n",
|
410 |
"\n",
|
411 |
"# --- ADDITIONAL ---\n",
|
412 |
"additional_header = widgets.HTML('<div class=\"header\">Additional</div>')\n",
|
|
|
436 |
"additional_widget_list = [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",
|
437 |
"if free_plan and env == \"Google Colab\":\n",
|
438 |
" additional_widget_list.remove(ngrok_widget)\n",
|
439 |
+
"display(widgets.VBox(additional_widget_list).add_class(\"container\").add_class(\"image_3\"))\n",
|
440 |
"\n",
|
441 |
"# --- CUSTOM DOWNLOAD ---\n",
|
442 |
"custom_download_header_popup = widgets.HTML('''\n",
|
|
|
474 |
"\n",
|
475 |
"display(widgets.VBox([\n",
|
476 |
" custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget\n",
|
477 |
+
" ]).add_class(\"container\").add_class(\"image_4\").add_class(\"container_custom_downlad\"))\n",
|
478 |
"\n",
|
479 |
"# --- Save Button ---\n",
|
480 |
"save_button = widgets.Button(description='Save').add_class(\"button_save\")\n",
|
|
|
482 |
"\n",
|
483 |
"\n",
|
484 |
"# ============ Load / Save - Settings V2 ============\n",
|
485 |
+
"try:\n",
|
486 |
+
" import toml\n",
|
487 |
+
"except ImportError: # SageMaker - only for you...\n",
|
488 |
+
" !pip install toml > /dev/null 2>&1\n",
|
489 |
+
" import toml\n",
|
490 |
+
"\n",
|
491 |
+
"SETTINGS_FILE = f'{root_path}/settings.toml'\n",
|
492 |
+
"\n",
|
493 |
+
"settings_structure = {\n",
|
494 |
+
" \"Model\": ['Model', 'Model_Num', 'Inpainting_Model'],\n",
|
495 |
+
" \"Vae\": ['Vae', 'Vae_Num'],\n",
|
496 |
+
" \"Additional\": ['latest_webui', 'latest_exstensions', 'detailed_download', 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token', 'ngrok_token', 'commandline_arguments'],\n",
|
497 |
+
" \"CustomUrl\": ['Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls']\n",
|
498 |
+
"}\n",
|
499 |
"\n",
|
500 |
"def save_settings():\n",
|
501 |
+
" settings = {}\n",
|
502 |
+
" for section, keys in settings_structure.items():\n",
|
503 |
+
" settings[section] = {key: globals()[f\"{key}_widget\"].value for key in keys}\n",
|
504 |
" with open(SETTINGS_FILE, 'w') as f:\n",
|
505 |
+
" toml.dump(settings, f)\n",
|
506 |
"\n",
|
507 |
"def load_settings():\n",
|
508 |
" if os.path.exists(SETTINGS_FILE):\n",
|
509 |
" with open(SETTINGS_FILE, 'r') as f:\n",
|
510 |
+
" loaded_settings = toml.load(f)\n",
|
511 |
+
" for section, keys in settings_structure.items():\n",
|
512 |
+
" for key in keys:\n",
|
513 |
+
" if key in loaded_settings[section]:\n",
|
514 |
+
" globals()[f\"{key}_widget\"].value = loaded_settings[section][key]\n",
|
515 |
"\n",
|
516 |
"def save_data(button):\n",
|
517 |
" save_settings()\n",
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
@@ -100,14 +100,20 @@
|
|
100 |
" clear_output()\n",
|
101 |
"\n",
|
102 |
"\n",
|
103 |
-
"# ================= loading settings
|
|
|
|
|
104 |
"def load_settings(path):\n",
|
105 |
" if os.path.exists(path):\n",
|
106 |
" with open(path, 'r') as file:\n",
|
107 |
-
"
|
|
|
|
|
|
|
|
|
108 |
" return {}\n",
|
109 |
"\n",
|
110 |
-
"settings = load_settings(f'{root_path}/settings.
|
111 |
"\n",
|
112 |
"variables = [\n",
|
113 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
@@ -505,7 +511,7 @@
|
|
505 |
"\n",
|
506 |
"\n",
|
507 |
"# Cleaning shit after downloading...\n",
|
508 |
-
"!find
|
509 |
"\n",
|
510 |
"\n",
|
511 |
"## Install of Custom extensions\n",
|
|
|
100 |
" clear_output()\n",
|
101 |
"\n",
|
102 |
"\n",
|
103 |
+
"# ================= loading settings V5 =================\n",
|
104 |
+
"import toml\n",
|
105 |
+
"\n",
|
106 |
"def load_settings(path):\n",
|
107 |
" if os.path.exists(path):\n",
|
108 |
" with open(path, 'r') as file:\n",
|
109 |
+
" settings = toml.load(file)\n",
|
110 |
+
" flat_settings = {}\n",
|
111 |
+
" for section, keys in settings.items():\n",
|
112 |
+
" flat_settings.update(keys)\n",
|
113 |
+
" return flat_settings\n",
|
114 |
" return {}\n",
|
115 |
"\n",
|
116 |
+
"settings = load_settings(f'{root_path}/settings.toml')\n",
|
117 |
"\n",
|
118 |
"variables = [\n",
|
119 |
" 'Model', 'Model_Num', 'Inpainting_Model',\n",
|
|
|
511 |
"\n",
|
512 |
"\n",
|
513 |
"# Cleaning shit after downloading...\n",
|
514 |
+
"!find {webui_path} \\( -type d \\( -name \".ipynb_checkpoints\" -o -name \".aria2\" \\) -o -type f -name \"*.aria2\" \\) -exec rm -r {{}} \\; >/dev/null 2>&1\n",
|
515 |
"\n",
|
516 |
"\n",
|
517 |
"## Install of Custom extensions\n",
|
files_cells/notebooks/ru/widgets_ru.ipynb
CHANGED
@@ -482,7 +482,11 @@
|
|
482 |
"\n",
|
483 |
"\n",
|
484 |
"# ============ Load / Save - Settings V3 ============\n",
|
485 |
-
"
|
|
|
|
|
|
|
|
|
486 |
"\n",
|
487 |
"SETTINGS_FILE = f'{root_path}/settings.toml'\n",
|
488 |
"\n",
|
|
|
482 |
"\n",
|
483 |
"\n",
|
484 |
"# ============ Load / Save - Settings V3 ============\n",
|
485 |
+
"try:\n",
|
486 |
+
" import toml\n",
|
487 |
+
"except ImportError: # SageMaker - only for you...\n",
|
488 |
+
" !pip install toml > /dev/null 2>&1\n",
|
489 |
+
" import toml\n",
|
490 |
"\n",
|
491 |
"SETTINGS_FILE = f'{root_path}/settings.toml'\n",
|
492 |
"\n",
|
files_cells/python/en/downloading_en.py
CHANGED
@@ -81,14 +81,20 @@ if not os.path.exists(flag_file):
|
|
81 |
clear_output()
|
82 |
|
83 |
|
84 |
-
# ================= loading settings
|
|
|
|
|
85 |
def load_settings(path):
|
86 |
if os.path.exists(path):
|
87 |
with open(path, 'r') as file:
|
88 |
-
|
|
|
|
|
|
|
|
|
89 |
return {}
|
90 |
|
91 |
-
settings = load_settings(f'{root_path}/settings.
|
92 |
|
93 |
variables = [
|
94 |
'Model', 'Model_Num', 'Inpainting_Model',
|
@@ -486,7 +492,7 @@ print("\r🏁 Download Complete!" + " "*15)
|
|
486 |
|
487 |
|
488 |
# Cleaning shit after downloading...
|
489 |
-
get_ipython().system('find
|
490 |
|
491 |
|
492 |
## Install of Custom extensions
|
|
|
81 |
clear_output()
|
82 |
|
83 |
|
84 |
+
# ================= loading settings V5 =================
|
85 |
+
import toml
|
86 |
+
|
87 |
def load_settings(path):
|
88 |
if os.path.exists(path):
|
89 |
with open(path, 'r') as file:
|
90 |
+
settings = toml.load(file)
|
91 |
+
flat_settings = {}
|
92 |
+
for section, keys in settings.items():
|
93 |
+
flat_settings.update(keys)
|
94 |
+
return flat_settings
|
95 |
return {}
|
96 |
|
97 |
+
settings = load_settings(f'{root_path}/settings.toml')
|
98 |
|
99 |
variables = [
|
100 |
'Model', 'Model_Num', 'Inpainting_Model',
|
|
|
492 |
|
493 |
|
494 |
# Cleaning shit after downloading...
|
495 |
+
get_ipython().system('find {webui_path} \\( -type d \\( -name ".ipynb_checkpoints" -o -name ".aria2" \\) -o -type f -name "*.aria2" \\) -exec rm -r {{}} \\; >/dev/null 2>&1')
|
496 |
|
497 |
|
498 |
## Install of Custom extensions
|
files_cells/python/en/widgets_en.py
CHANGED
@@ -28,6 +28,49 @@ get_ipython().system('mkdir -p {root_path}')
|
|
28 |
|
29 |
|
30 |
# ==================== CSS JS ====================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
CSS = '''
|
32 |
<style>
|
33 |
/* General Styles */
|
@@ -59,7 +102,7 @@ hr {
|
|
59 |
border-radius: 15px;
|
60 |
box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
|
61 |
margin-bottom: 5px;
|
62 |
-
overflow:
|
63 |
}
|
64 |
|
65 |
.container::after {
|
@@ -72,9 +115,38 @@ hr {
|
|
72 |
color: rgba(0, 0, 0, 0.15);
|
73 |
}
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
.container_custom_downlad {
|
76 |
height: 55px;
|
77 |
-
overflow: hidden;
|
78 |
transition: all 0.5s;
|
79 |
}
|
80 |
|
@@ -104,7 +176,7 @@ hr {
|
|
104 |
|
105 |
|
106 |
/* Input field styles */
|
107 |
-
|
108 |
.widget-dropdown select,
|
109 |
.widget-text input[type="text"] {
|
110 |
height: 30px;
|
@@ -114,6 +186,7 @@ hr {
|
|
114 |
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
|
115 |
transition: all 0.3s ease-in-out;
|
116 |
}
|
|
|
117 |
|
118 |
.widget-dropdown select:focus,
|
119 |
.widget-text input[type="text"]:focus {
|
@@ -301,7 +374,7 @@ Model_widget = widgets.Dropdown(options=model_options, value='3.Counterfeit [Ani
|
|
301 |
Model_Num_widget = widgets.Text(description='Model Number:', placeholder='Enter the model numbers to be downloaded using comma/space.', style=style, layout=layout)
|
302 |
Inpainting_Model_widget = widgets.Checkbox(value=False, description='Inpainting Models', style=style)
|
303 |
|
304 |
-
display(widgets.VBox([model_header, Model_widget, Model_Num_widget, Inpainting_Model_widget]).add_class("container"))
|
305 |
|
306 |
# --- VAE ---
|
307 |
vae_header = widgets.HTML('<div class="header" >VAE Selection</div>')
|
@@ -314,7 +387,7 @@ vae_options = ['none',
|
|
314 |
Vae_widget = widgets.Dropdown(options=vae_options, value='3.Blessed2.vae', description='Vae:', style=style, layout=layout)
|
315 |
Vae_Num_widget = widgets.Text(description='Vae number:', placeholder='Enter the vae numbers to be downloaded using comma/space.', style=style, layout=layout)
|
316 |
|
317 |
-
display(widgets.VBox([vae_header, Vae_widget, Vae_Num_widget]).add_class("container"))
|
318 |
|
319 |
# --- ADDITIONAL ---
|
320 |
additional_header = widgets.HTML('<div class="header">Additional</div>')
|
@@ -344,7 +417,7 @@ commandline_arguments_widget = widgets.Text(description='Arguments:', value=comm
|
|
344 |
additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, HR, commandline_arguments_widget]
|
345 |
if free_plan and env == "Google Colab":
|
346 |
additional_widget_list.remove(ngrok_widget)
|
347 |
-
display(widgets.VBox(additional_widget_list).add_class("container"))
|
348 |
|
349 |
# --- CUSTOM DOWNLOAD ---
|
350 |
custom_download_header_popup = widgets.HTML('''
|
@@ -382,7 +455,7 @@ custom_file_urls_widget = widgets.Text(description='File (txt):', style=style, l
|
|
382 |
|
383 |
display(widgets.VBox([
|
384 |
custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget
|
385 |
-
]).add_class("container").add_class("container_custom_downlad"))
|
386 |
|
387 |
# --- Save Button ---
|
388 |
save_button = widgets.Button(description='Save').add_class("button_save")
|
@@ -390,28 +463,36 @@ display(save_button)
|
|
390 |
|
391 |
|
392 |
# ============ Load / Save - Settings V2 ============
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
'
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
]
|
|
|
|
|
|
|
|
|
403 |
|
404 |
def save_settings():
|
405 |
-
settings = {
|
|
|
|
|
406 |
with open(SETTINGS_FILE, 'w') as f:
|
407 |
-
|
408 |
|
409 |
def load_settings():
|
410 |
if os.path.exists(SETTINGS_FILE):
|
411 |
with open(SETTINGS_FILE, 'r') as f:
|
412 |
-
|
413 |
-
for
|
414 |
-
|
|
|
|
|
415 |
|
416 |
def save_data(button):
|
417 |
save_settings()
|
|
|
28 |
|
29 |
|
30 |
# ==================== CSS JS ====================
|
31 |
+
# custom background images (test)
|
32 |
+
import argparse
|
33 |
+
parser = argparse.ArgumentParser(description='This script processes an background image.')
|
34 |
+
parser.add_argument('-i', '--image', type=str, help='URL of the image to process', metavar='')
|
35 |
+
parser.add_argument('-o', '--opacity', type=float, help='Opacity level for the image, between 0 and 1', metavar='', default=0.3)
|
36 |
+
parser.add_argument('-b', '--blur', type=str, help='Blur level for the image', metavar='', default=0)
|
37 |
+
parser.add_argument('-y', type=int, help='Y coordinate for the image in px', metavar='', default=0)
|
38 |
+
parser.add_argument('-x', type=int, help='X coordinate for the image in px', metavar='', default=0)
|
39 |
+
parser.add_argument('-s', '--scale', type=int, help='Scale image in %%', metavar='', default=100)
|
40 |
+
parser.add_argument('-m', '--mode', type=str, help='Specify "no-repeat" so that the image pattern is not repeated.', metavar='', default='repeat')
|
41 |
+
parser.add_argument('-t', '--transparent', action='store_true', help='Flag to exclude z-index from CSS. Makes fields transparent')
|
42 |
+
args = parser.parse_args()
|
43 |
+
# ---
|
44 |
+
url_img, opacity_img, blur_img, y_img, x_img, scale_img, mode_img = args.image, args.opacity, args.blur, args.y, args.x, args.scale, args.mode
|
45 |
+
|
46 |
+
container_background = f'''
|
47 |
+
<style>
|
48 |
+
:root {{
|
49 |
+
--img_background: url({url_img});
|
50 |
+
--img_opacity: {opacity_img};
|
51 |
+
--img_blur: {blur_img}px;
|
52 |
+
--image_y: {y_img}px;
|
53 |
+
--image_x: {x_img}px;
|
54 |
+
--img_scale: {scale_img}%;
|
55 |
+
--img_mode: {mode_img};
|
56 |
+
}}
|
57 |
+
|
58 |
+
.widget-dropdown select,
|
59 |
+
.widget-text input[type="text"] {{
|
60 |
+
height: 30px;
|
61 |
+
background-color: #1c1c1c;
|
62 |
+
border: 1px solid #262626;
|
63 |
+
border-radius: 10px;
|
64 |
+
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
|
65 |
+
transition: all 0.3s ease-in-out;
|
66 |
+
'''
|
67 |
+
|
68 |
+
if not args.transparent:
|
69 |
+
container_background += " z-index: 1;\n</style>\n"
|
70 |
+
|
71 |
+
display(HTML(container_background))
|
72 |
+
# ---
|
73 |
+
|
74 |
CSS = '''
|
75 |
<style>
|
76 |
/* General Styles */
|
|
|
102 |
border-radius: 15px;
|
103 |
box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
|
104 |
margin-bottom: 5px;
|
105 |
+
overflow: hidden;
|
106 |
}
|
107 |
|
108 |
.container::after {
|
|
|
115 |
color: rgba(0, 0, 0, 0.15);
|
116 |
}
|
117 |
|
118 |
+
/* background img */
|
119 |
+
.container::before {
|
120 |
+
content: "";
|
121 |
+
position: absolute;
|
122 |
+
top: 0;
|
123 |
+
left: 0;
|
124 |
+
right: 0;
|
125 |
+
bottom: 0;
|
126 |
+
background-image: var(--img_background);
|
127 |
+
background-size: var(--img_scale);
|
128 |
+
background-repeat: var(--img_mode);
|
129 |
+
opacity: var(--img_opacity);
|
130 |
+
mix-blend-mode: screen;
|
131 |
+
pointer-events: none;
|
132 |
+
filter: blur(var(--img_blur));
|
133 |
+
}
|
134 |
+
|
135 |
+
.image_1::before {
|
136 |
+
background-position: var(--image_x) calc(-120px - var(--image_y));
|
137 |
+
}
|
138 |
+
.image_2::before {
|
139 |
+
background-position: var(--image_x) calc(-290px - var(--image_y));
|
140 |
+
}
|
141 |
+
.image_3::before {
|
142 |
+
background-position: var(--image_x) calc(-430px - var(--image_y));
|
143 |
+
}
|
144 |
+
.image_4::before {
|
145 |
+
background-position: var(--image_x) calc(-740px - var(--image_y));
|
146 |
+
}
|
147 |
+
|
148 |
.container_custom_downlad {
|
149 |
height: 55px;
|
|
|
150 |
transition: all 0.5s;
|
151 |
}
|
152 |
|
|
|
176 |
|
177 |
|
178 |
/* Input field styles */
|
179 |
+
/*
|
180 |
.widget-dropdown select,
|
181 |
.widget-text input[type="text"] {
|
182 |
height: 30px;
|
|
|
186 |
box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
|
187 |
transition: all 0.3s ease-in-out;
|
188 |
}
|
189 |
+
*/
|
190 |
|
191 |
.widget-dropdown select:focus,
|
192 |
.widget-text input[type="text"]:focus {
|
|
|
374 |
Model_Num_widget = widgets.Text(description='Model Number:', placeholder='Enter the model numbers to be downloaded using comma/space.', style=style, layout=layout)
|
375 |
Inpainting_Model_widget = widgets.Checkbox(value=False, description='Inpainting Models', style=style)
|
376 |
|
377 |
+
display(widgets.VBox([model_header, Model_widget, Model_Num_widget, Inpainting_Model_widget]).add_class("container").add_class("image_1"))
|
378 |
|
379 |
# --- VAE ---
|
380 |
vae_header = widgets.HTML('<div class="header" >VAE Selection</div>')
|
|
|
387 |
Vae_widget = widgets.Dropdown(options=vae_options, value='3.Blessed2.vae', description='Vae:', style=style, layout=layout)
|
388 |
Vae_Num_widget = widgets.Text(description='Vae number:', placeholder='Enter the vae numbers to be downloaded using comma/space.', style=style, layout=layout)
|
389 |
|
390 |
+
display(widgets.VBox([vae_header, Vae_widget, Vae_Num_widget]).add_class("container").add_class("image_2"))
|
391 |
|
392 |
# --- ADDITIONAL ---
|
393 |
additional_header = widgets.HTML('<div class="header">Additional</div>')
|
|
|
417 |
additional_widget_list = [additional_header, latest_changes_widget, HR, controlnet_widget, controlnet_Num_widget, commit_hash_widget, optional_huggingface_token_widget, ngrok_widget, HR, commandline_arguments_widget]
|
418 |
if free_plan and env == "Google Colab":
|
419 |
additional_widget_list.remove(ngrok_widget)
|
420 |
+
display(widgets.VBox(additional_widget_list).add_class("container").add_class("image_3"))
|
421 |
|
422 |
# --- CUSTOM DOWNLOAD ---
|
423 |
custom_download_header_popup = widgets.HTML('''
|
|
|
455 |
|
456 |
display(widgets.VBox([
|
457 |
custom_download_header_popup, Model_url_widget, Vae_url_widget, LoRA_url_widget, Embedding_url_widget, Extensions_url_widget, custom_file_urls_widget
|
458 |
+
]).add_class("container").add_class("image_4").add_class("container_custom_downlad"))
|
459 |
|
460 |
# --- Save Button ---
|
461 |
save_button = widgets.Button(description='Save').add_class("button_save")
|
|
|
463 |
|
464 |
|
465 |
# ============ Load / Save - Settings V2 ============
|
466 |
+
try:
|
467 |
+
import toml
|
468 |
+
except ImportError: # SageMaker - only for you...
|
469 |
+
get_ipython().system('pip install toml > /dev/null 2>&1')
|
470 |
+
import toml
|
471 |
+
|
472 |
+
SETTINGS_FILE = f'{root_path}/settings.toml'
|
473 |
+
|
474 |
+
settings_structure = {
|
475 |
+
"Model": ['Model', 'Model_Num', 'Inpainting_Model'],
|
476 |
+
"Vae": ['Vae', 'Vae_Num'],
|
477 |
+
"Additional": ['latest_webui', 'latest_exstensions', 'detailed_download', 'controlnet', 'controlnet_Num', 'commit_hash', 'optional_huggingface_token', 'ngrok_token', 'commandline_arguments'],
|
478 |
+
"CustomUrl": ['Model_url', 'Vae_url', 'LoRA_url', 'Embedding_url', 'Extensions_url', 'custom_file_urls']
|
479 |
+
}
|
480 |
|
481 |
def save_settings():
|
482 |
+
settings = {}
|
483 |
+
for section, keys in settings_structure.items():
|
484 |
+
settings[section] = {key: globals()[f"{key}_widget"].value for key in keys}
|
485 |
with open(SETTINGS_FILE, 'w') as f:
|
486 |
+
toml.dump(settings, f)
|
487 |
|
488 |
def load_settings():
|
489 |
if os.path.exists(SETTINGS_FILE):
|
490 |
with open(SETTINGS_FILE, 'r') as f:
|
491 |
+
loaded_settings = toml.load(f)
|
492 |
+
for section, keys in settings_structure.items():
|
493 |
+
for key in keys:
|
494 |
+
if key in loaded_settings[section]:
|
495 |
+
globals()[f"{key}_widget"].value = loaded_settings[section][key]
|
496 |
|
497 |
def save_data(button):
|
498 |
save_settings()
|
files_cells/python/ru/downloading_ru.py
CHANGED
@@ -81,14 +81,20 @@ if not os.path.exists(flag_file):
|
|
81 |
clear_output()
|
82 |
|
83 |
|
84 |
-
# ================= loading settings
|
|
|
|
|
85 |
def load_settings(path):
|
86 |
if os.path.exists(path):
|
87 |
with open(path, 'r') as file:
|
88 |
-
|
|
|
|
|
|
|
|
|
89 |
return {}
|
90 |
|
91 |
-
settings = load_settings(f'{root_path}/settings.
|
92 |
|
93 |
variables = [
|
94 |
'Model', 'Model_Num', 'Inpainting_Model',
|
@@ -486,7 +492,7 @@ print("\r🏁 Скачивание Завершено!" + " "*15)
|
|
486 |
|
487 |
|
488 |
# Cleaning shit after downloading...
|
489 |
-
get_ipython().system('find
|
490 |
|
491 |
|
492 |
## Install of Custom extensions
|
|
|
81 |
clear_output()
|
82 |
|
83 |
|
84 |
+
# ================= loading settings V5 =================
|
85 |
+
import toml
|
86 |
+
|
87 |
def load_settings(path):
|
88 |
if os.path.exists(path):
|
89 |
with open(path, 'r') as file:
|
90 |
+
settings = toml.load(file)
|
91 |
+
flat_settings = {}
|
92 |
+
for section, keys in settings.items():
|
93 |
+
flat_settings.update(keys)
|
94 |
+
return flat_settings
|
95 |
return {}
|
96 |
|
97 |
+
settings = load_settings(f'{root_path}/settings.toml')
|
98 |
|
99 |
variables = [
|
100 |
'Model', 'Model_Num', 'Inpainting_Model',
|
|
|
492 |
|
493 |
|
494 |
# Cleaning shit after downloading...
|
495 |
+
get_ipython().system('find {webui_path} \\( -type d \\( -name ".ipynb_checkpoints" -o -name ".aria2" \\) -o -type f -name "*.aria2" \\) -exec rm -r {{}} \\; >/dev/null 2>&1')
|
496 |
|
497 |
|
498 |
## Install of Custom extensions
|
files_cells/python/ru/widgets_ru.py
CHANGED
@@ -463,7 +463,11 @@ display(save_button)
|
|
463 |
|
464 |
|
465 |
# ============ Load / Save - Settings V3 ============
|
466 |
-
|
|
|
|
|
|
|
|
|
467 |
|
468 |
SETTINGS_FILE = f'{root_path}/settings.toml'
|
469 |
|
|
|
463 |
|
464 |
|
465 |
# ============ Load / Save - Settings V3 ============
|
466 |
+
try:
|
467 |
+
import toml
|
468 |
+
except ImportError: # SageMaker - only for you...
|
469 |
+
get_ipython().system('pip install toml > /dev/null 2>&1')
|
470 |
+
import toml
|
471 |
|
472 |
SETTINGS_FILE = f'{root_path}/settings.toml'
|
473 |
|