✨ file download update
Browse files- Automatically get an extension for a custom file name
- files_cells/notebooks/en/auto_cleaner_en.ipynb +3 -3
- files_cells/notebooks/en/downloading_en.ipynb +12 -3
- files_cells/notebooks/ru/auto_cleaner_ru.ipynb +3 -3
- files_cells/notebooks/ru/downloading_ru.ipynb +13 -4
- files_cells/python/en/auto_cleaner_en.py +3 -3
- files_cells/python/en/downloading_en.py +12 -3
- files_cells/python/ru/auto_cleaner_ru.py +3 -3
- files_cells/python/ru/downloading_ru.py +13 -4
files_cells/notebooks/en/auto_cleaner_en.ipynb
CHANGED
@@ -131,9 +131,9 @@
|
|
131 |
"auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width='auto')).add_class(\"custom-select-multiple_AC\")\n",
|
132 |
"output = widgets.Output().add_class(\"output_AC\")\n",
|
133 |
"# ---\n",
|
134 |
-
"execute_button = Button(description='Execute Cleaning').add_class(\"button_execute_AC\").add_class(\"button_AC\")\n",
|
135 |
"execute_button.on_click(on_execute_button_press)\n",
|
136 |
-
"clear_button = Button(description='Hide Widget').add_class(\"button_clear_AC\").add_class(\"button_AC\")\n",
|
137 |
"clear_button.on_click(on_clear_button_press)\n",
|
138 |
"# ---\n",
|
139 |
"storage_info = widgets.HTML(f'''\n",
|
@@ -143,7 +143,7 @@
|
|
143 |
"buttons = widgets.HBox([execute_button, clear_button])\n",
|
144 |
"lower_information_panel = widgets.HBox([buttons, storage_info]).add_class(\"lower_information_panel_AC\")\n",
|
145 |
"\n",
|
146 |
-
"container = VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class(\"container_AC\")\n",
|
147 |
"\n",
|
148 |
"display(container)"
|
149 |
],
|
|
|
131 |
"auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width='auto')).add_class(\"custom-select-multiple_AC\")\n",
|
132 |
"output = widgets.Output().add_class(\"output_AC\")\n",
|
133 |
"# ---\n",
|
134 |
+
"execute_button = widgets.Button(description='Execute Cleaning').add_class(\"button_execute_AC\").add_class(\"button_AC\")\n",
|
135 |
"execute_button.on_click(on_execute_button_press)\n",
|
136 |
+
"clear_button = widgets.Button(description='Hide Widget').add_class(\"button_clear_AC\").add_class(\"button_AC\")\n",
|
137 |
"clear_button.on_click(on_clear_button_press)\n",
|
138 |
"# ---\n",
|
139 |
"storage_info = widgets.HTML(f'''\n",
|
|
|
143 |
"buttons = widgets.HBox([execute_button, clear_button])\n",
|
144 |
"lower_information_panel = widgets.HBox([buttons, storage_info]).add_class(\"lower_information_panel_AC\")\n",
|
145 |
"\n",
|
146 |
+
"container = widgets.VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class(\"container_AC\")\n",
|
147 |
"\n",
|
148 |
"display(container)"
|
149 |
],
|
files_cells/notebooks/en/downloading_en.ipynb
CHANGED
@@ -330,6 +330,12 @@
|
|
330 |
" model_type = data['files'][1]['type']\n",
|
331 |
" model_name = data['files'][1]['name']\n",
|
332 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
" return model_type, model_name\n",
|
334 |
"\n",
|
335 |
" def get_download_url(data, model_type):\n",
|
@@ -352,7 +358,6 @@
|
|
352 |
" return None, None\n",
|
353 |
"\n",
|
354 |
" model_type, model_name = get_model_info(url, data)\n",
|
355 |
-
" model_name = file_name or model_name\n",
|
356 |
" download_url = get_download_url(data, model_type)\n",
|
357 |
" image_url, image_name = get_image_info(data, model_type, model_name)\n",
|
358 |
"\n",
|
@@ -421,8 +426,12 @@
|
|
421 |
" command = [\"aria2c\"] + aria2_args.split() + [\"-d\", dst_dir, \"-o\", image_name, image_url]\n",
|
422 |
" subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
|
423 |
"\n",
|
424 |
-
" elif 'github' in url or
|
425 |
-
" file_name
|
|
|
|
|
|
|
|
|
426 |
"\n",
|
427 |
" \"\"\" Formatted info output \"\"\"\n",
|
428 |
" try:\n",
|
|
|
330 |
" model_type = data['files'][1]['type']\n",
|
331 |
" model_name = data['files'][1]['name']\n",
|
332 |
"\n",
|
333 |
+
" if file_name and '.' not in file_name:\n",
|
334 |
+
" file_extension = model_name.split('.')[-1]\n",
|
335 |
+
" model_name = f\"{file_name}.{file_extension}\"\n",
|
336 |
+
" elif file_name:\n",
|
337 |
+
" model_name = file_name\n",
|
338 |
+
"\n",
|
339 |
" return model_type, model_name\n",
|
340 |
"\n",
|
341 |
" def get_download_url(data, model_type):\n",
|
|
|
358 |
" return None, None\n",
|
359 |
"\n",
|
360 |
" model_type, model_name = get_model_info(url, data)\n",
|
|
|
361 |
" download_url = get_download_url(data, model_type)\n",
|
362 |
" image_url, image_name = get_image_info(data, model_type, model_name)\n",
|
363 |
"\n",
|
|
|
426 |
" command = [\"aria2c\"] + aria2_args.split() + [\"-d\", dst_dir, \"-o\", image_name, image_url]\n",
|
427 |
" subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
|
428 |
"\n",
|
429 |
+
" elif 'github' in url or 'huggingface.co' in url:\n",
|
430 |
+
" if file_name and '.' not in file_name:\n",
|
431 |
+
" file_extension = f\"{clean_url.split('/')[-1].split('.', 1)[1]}\"\n",
|
432 |
+
" file_name = f\"{file_name}.{file_extension}\"\n",
|
433 |
+
" if not file_name:\n",
|
434 |
+
" file_name = clean_url.split(\"/\")[-1]\n",
|
435 |
"\n",
|
436 |
" \"\"\" Formatted info output \"\"\"\n",
|
437 |
" try:\n",
|
files_cells/notebooks/ru/auto_cleaner_ru.ipynb
CHANGED
@@ -136,9 +136,9 @@
|
|
136 |
"auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width=\"auto\")).add_class(\"custom-select-multiple_AC\")\n",
|
137 |
"output = widgets.Output().add_class(\"output_AC\")\n",
|
138 |
"\n",
|
139 |
-
"execute_button = Button(description='Выполнить Очистку').add_class(\"button_execute_AC\").add_class(\"button_AC\")\n",
|
140 |
"execute_button.on_click(on_execute_button_press)\n",
|
141 |
-
"clear_button = Button(description='Скрыть Виджет').add_class(\"button_clear_AC\").add_class(\"button_AC\")\n",
|
142 |
"clear_button.on_click(on_clear_button_press)\n",
|
143 |
"\n",
|
144 |
"storage_info = widgets.HTML(f'''\n",
|
@@ -148,7 +148,7 @@
|
|
148 |
"buttons = widgets.HBox([execute_button, clear_button])\n",
|
149 |
"lower_information_panel = widgets.HBox([buttons, storage_info]).add_class(\"lower_information_panel_AC\")\n",
|
150 |
"\n",
|
151 |
-
"container = VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class(\"container_AC\")\n",
|
152 |
"\n",
|
153 |
"display(container)"
|
154 |
]
|
|
|
136 |
"auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width=\"auto\")).add_class(\"custom-select-multiple_AC\")\n",
|
137 |
"output = widgets.Output().add_class(\"output_AC\")\n",
|
138 |
"\n",
|
139 |
+
"execute_button = widgets.Button(description='Выполнить Очистку').add_class(\"button_execute_AC\").add_class(\"button_AC\")\n",
|
140 |
"execute_button.on_click(on_execute_button_press)\n",
|
141 |
+
"clear_button = widgets.Button(description='Скрыть Виджет').add_class(\"button_clear_AC\").add_class(\"button_AC\")\n",
|
142 |
"clear_button.on_click(on_clear_button_press)\n",
|
143 |
"\n",
|
144 |
"storage_info = widgets.HTML(f'''\n",
|
|
|
148 |
"buttons = widgets.HBox([execute_button, clear_button])\n",
|
149 |
"lower_information_panel = widgets.HBox([buttons, storage_info]).add_class(\"lower_information_panel_AC\")\n",
|
150 |
"\n",
|
151 |
+
"container = widgets.VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class(\"container_AC\")\n",
|
152 |
"\n",
|
153 |
"display(container)"
|
154 |
]
|
files_cells/notebooks/ru/downloading_ru.ipynb
CHANGED
@@ -95,7 +95,7 @@
|
|
95 |
" subprocess.run(install_cmd, shell=True, capture_output=True)\n",
|
96 |
"\n",
|
97 |
" # Additional specific packages\n",
|
98 |
-
" with capture.capture_output()
|
99 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
100 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
101 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.32/zrok_0.4.32_linux_amd64.tar.gz && tar -xzf zrok_0.4.32_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.32_linux_amd64.tar.gz\n",
|
@@ -330,6 +330,12 @@
|
|
330 |
" model_type = data['files'][1]['type']\n",
|
331 |
" model_name = data['files'][1]['name']\n",
|
332 |
"\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
" return model_type, model_name\n",
|
334 |
"\n",
|
335 |
" def get_download_url(data, model_type):\n",
|
@@ -352,7 +358,6 @@
|
|
352 |
" return None, None\n",
|
353 |
"\n",
|
354 |
" model_type, model_name = get_model_info(url, data)\n",
|
355 |
-
" model_name = file_name or model_name\n",
|
356 |
" download_url = get_download_url(data, model_type)\n",
|
357 |
" image_url, image_name = get_image_info(data, model_type, model_name)\n",
|
358 |
"\n",
|
@@ -421,8 +426,12 @@
|
|
421 |
" command = [\"aria2c\"] + aria2_args.split() + [\"-d\", dst_dir, \"-o\", image_name, image_url]\n",
|
422 |
" subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
|
423 |
"\n",
|
424 |
-
" elif 'github' in url or
|
425 |
-
" file_name
|
|
|
|
|
|
|
|
|
426 |
"\n",
|
427 |
" \"\"\" Formatted info output \"\"\"\n",
|
428 |
" try:\n",
|
|
|
95 |
" subprocess.run(install_cmd, shell=True, capture_output=True)\n",
|
96 |
"\n",
|
97 |
" # Additional specific packages\n",
|
98 |
+
" with capture.capture_output():\n",
|
99 |
" !curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}\n",
|
100 |
" !curl -s -Lo /usr/bin/cl https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 && chmod +x /usr/bin/cl\n",
|
101 |
" !curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.32/zrok_0.4.32_linux_amd64.tar.gz && tar -xzf zrok_0.4.32_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.32_linux_amd64.tar.gz\n",
|
|
|
330 |
" model_type = data['files'][1]['type']\n",
|
331 |
" model_name = data['files'][1]['name']\n",
|
332 |
"\n",
|
333 |
+
" if file_name and '.' not in file_name:\n",
|
334 |
+
" file_extension = model_name.split('.')[-1]\n",
|
335 |
+
" model_name = f\"{file_name}.{file_extension}\"\n",
|
336 |
+
" elif file_name:\n",
|
337 |
+
" model_name = file_name\n",
|
338 |
+
"\n",
|
339 |
" return model_type, model_name\n",
|
340 |
"\n",
|
341 |
" def get_download_url(data, model_type):\n",
|
|
|
358 |
" return None, None\n",
|
359 |
"\n",
|
360 |
" model_type, model_name = get_model_info(url, data)\n",
|
|
|
361 |
" download_url = get_download_url(data, model_type)\n",
|
362 |
" image_url, image_name = get_image_info(data, model_type, model_name)\n",
|
363 |
"\n",
|
|
|
426 |
" command = [\"aria2c\"] + aria2_args.split() + [\"-d\", dst_dir, \"-o\", image_name, image_url]\n",
|
427 |
" subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)\n",
|
428 |
"\n",
|
429 |
+
" elif 'github' in url or 'huggingface.co' in url:\n",
|
430 |
+
" if file_name and '.' not in file_name:\n",
|
431 |
+
" file_extension = f\"{clean_url.split('/')[-1].split('.', 1)[1]}\"\n",
|
432 |
+
" file_name = f\"{file_name}.{file_extension}\"\n",
|
433 |
+
" if not file_name:\n",
|
434 |
+
" file_name = clean_url.split(\"/\")[-1]\n",
|
435 |
"\n",
|
436 |
" \"\"\" Formatted info output \"\"\"\n",
|
437 |
" try:\n",
|
files_cells/python/en/auto_cleaner_en.py
CHANGED
@@ -112,9 +112,9 @@ instruction_label = widgets.HTML('''
|
|
112 |
auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width='auto')).add_class("custom-select-multiple_AC")
|
113 |
output = widgets.Output().add_class("output_AC")
|
114 |
# ---
|
115 |
-
execute_button = Button(description='Execute Cleaning').add_class("button_execute_AC").add_class("button_AC")
|
116 |
execute_button.on_click(on_execute_button_press)
|
117 |
-
clear_button = Button(description='Hide Widget').add_class("button_clear_AC").add_class("button_AC")
|
118 |
clear_button.on_click(on_clear_button_press)
|
119 |
# ---
|
120 |
storage_info = widgets.HTML(f'''
|
@@ -124,7 +124,7 @@ storage_info = widgets.HTML(f'''
|
|
124 |
buttons = widgets.HBox([execute_button, clear_button])
|
125 |
lower_information_panel = widgets.HBox([buttons, storage_info]).add_class("lower_information_panel_AC")
|
126 |
|
127 |
-
container = VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class("container_AC")
|
128 |
|
129 |
display(container)
|
130 |
|
|
|
112 |
auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width='auto')).add_class("custom-select-multiple_AC")
|
113 |
output = widgets.Output().add_class("output_AC")
|
114 |
# ---
|
115 |
+
execute_button = widgets.Button(description='Execute Cleaning').add_class("button_execute_AC").add_class("button_AC")
|
116 |
execute_button.on_click(on_execute_button_press)
|
117 |
+
clear_button = widgets.Button(description='Hide Widget').add_class("button_clear_AC").add_class("button_AC")
|
118 |
clear_button.on_click(on_clear_button_press)
|
119 |
# ---
|
120 |
storage_info = widgets.HTML(f'''
|
|
|
124 |
buttons = widgets.HBox([execute_button, clear_button])
|
125 |
lower_information_panel = widgets.HBox([buttons, storage_info]).add_class("lower_information_panel_AC")
|
126 |
|
127 |
+
container = widgets.VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class("container_AC")
|
128 |
|
129 |
display(container)
|
130 |
|
files_cells/python/en/downloading_en.py
CHANGED
@@ -320,6 +320,12 @@ def CivitAi_API(url, file_name=None):
|
|
320 |
model_type = data['files'][1]['type']
|
321 |
model_name = data['files'][1]['name']
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
return model_type, model_name
|
324 |
|
325 |
def get_download_url(data, model_type):
|
@@ -342,7 +348,6 @@ def CivitAi_API(url, file_name=None):
|
|
342 |
return None, None
|
343 |
|
344 |
model_type, model_name = get_model_info(url, data)
|
345 |
-
model_name = file_name or model_name
|
346 |
download_url = get_download_url(data, model_type)
|
347 |
image_url, image_name = get_image_info(data, model_type, model_name)
|
348 |
|
@@ -411,8 +416,12 @@ def manual_download(url, dst_dir, file_name, prefix=None):
|
|
411 |
command = ["aria2c"] + aria2_args.split() + ["-d", dst_dir, "-o", image_name, image_url]
|
412 |
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
413 |
|
414 |
-
elif 'github' in url or
|
415 |
-
file_name
|
|
|
|
|
|
|
|
|
416 |
|
417 |
""" Formatted info output """
|
418 |
try:
|
|
|
320 |
model_type = data['files'][1]['type']
|
321 |
model_name = data['files'][1]['name']
|
322 |
|
323 |
+
if file_name and '.' not in file_name:
|
324 |
+
file_extension = model_name.split('.')[-1]
|
325 |
+
model_name = f"{file_name}.{file_extension}"
|
326 |
+
elif file_name:
|
327 |
+
model_name = file_name
|
328 |
+
|
329 |
return model_type, model_name
|
330 |
|
331 |
def get_download_url(data, model_type):
|
|
|
348 |
return None, None
|
349 |
|
350 |
model_type, model_name = get_model_info(url, data)
|
|
|
351 |
download_url = get_download_url(data, model_type)
|
352 |
image_url, image_name = get_image_info(data, model_type, model_name)
|
353 |
|
|
|
416 |
command = ["aria2c"] + aria2_args.split() + ["-d", dst_dir, "-o", image_name, image_url]
|
417 |
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
418 |
|
419 |
+
elif 'github' in url or 'huggingface.co' in url:
|
420 |
+
if file_name and '.' not in file_name:
|
421 |
+
file_extension = f"{clean_url.split('/')[-1].split('.', 1)[1]}"
|
422 |
+
file_name = f"{file_name}.{file_extension}"
|
423 |
+
if not file_name:
|
424 |
+
file_name = clean_url.split("/")[-1]
|
425 |
|
426 |
""" Formatted info output """
|
427 |
try:
|
files_cells/python/ru/auto_cleaner_ru.py
CHANGED
@@ -112,9 +112,9 @@ instruction_label = widgets.HTML('''
|
|
112 |
auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width="auto")).add_class("custom-select-multiple_AC")
|
113 |
output = widgets.Output().add_class("output_AC")
|
114 |
|
115 |
-
execute_button = Button(description='Выполнить Очистку').add_class("button_execute_AC").add_class("button_AC")
|
116 |
execute_button.on_click(on_execute_button_press)
|
117 |
-
clear_button = Button(description='Скрыть Виджет').add_class("button_clear_AC").add_class("button_AC")
|
118 |
clear_button.on_click(on_clear_button_press)
|
119 |
|
120 |
storage_info = widgets.HTML(f'''
|
@@ -124,7 +124,7 @@ storage_info = widgets.HTML(f'''
|
|
124 |
buttons = widgets.HBox([execute_button, clear_button])
|
125 |
lower_information_panel = widgets.HBox([buttons, storage_info]).add_class("lower_information_panel_AC")
|
126 |
|
127 |
-
container = VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class("container_AC")
|
128 |
|
129 |
display(container)
|
130 |
|
|
|
112 |
auto_cleaner_widget = widgets.SelectMultiple(options=AutoCleaner_options, layout=widgets.Layout(width="auto")).add_class("custom-select-multiple_AC")
|
113 |
output = widgets.Output().add_class("output_AC")
|
114 |
|
115 |
+
execute_button = widgets.Button(description='Выполнить Очистку').add_class("button_execute_AC").add_class("button_AC")
|
116 |
execute_button.on_click(on_execute_button_press)
|
117 |
+
clear_button = widgets.Button(description='Скрыть Виджет').add_class("button_clear_AC").add_class("button_AC")
|
118 |
clear_button.on_click(on_clear_button_press)
|
119 |
|
120 |
storage_info = widgets.HTML(f'''
|
|
|
124 |
buttons = widgets.HBox([execute_button, clear_button])
|
125 |
lower_information_panel = widgets.HBox([buttons, storage_info]).add_class("lower_information_panel_AC")
|
126 |
|
127 |
+
container = widgets.VBox([instruction_label, widgets.HTML('<hr>'), auto_cleaner_widget, output, widgets.HTML('<hr>'), lower_information_panel]).add_class("container_AC")
|
128 |
|
129 |
display(container)
|
130 |
|
files_cells/python/ru/downloading_ru.py
CHANGED
@@ -85,7 +85,7 @@ if not os.path.exists(flag_file):
|
|
85 |
subprocess.run(install_cmd, shell=True, capture_output=True)
|
86 |
|
87 |
# Additional specific packages
|
88 |
-
with capture.capture_output()
|
89 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
90 |
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')
|
91 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.32/zrok_0.4.32_linux_amd64.tar.gz && tar -xzf zrok_0.4.32_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.32_linux_amd64.tar.gz')
|
@@ -320,6 +320,12 @@ def CivitAi_API(url, file_name=None):
|
|
320 |
model_type = data['files'][1]['type']
|
321 |
model_name = data['files'][1]['name']
|
322 |
|
|
|
|
|
|
|
|
|
|
|
|
|
323 |
return model_type, model_name
|
324 |
|
325 |
def get_download_url(data, model_type):
|
@@ -342,7 +348,6 @@ def CivitAi_API(url, file_name=None):
|
|
342 |
return None, None
|
343 |
|
344 |
model_type, model_name = get_model_info(url, data)
|
345 |
-
model_name = file_name or model_name
|
346 |
download_url = get_download_url(data, model_type)
|
347 |
image_url, image_name = get_image_info(data, model_type, model_name)
|
348 |
|
@@ -411,8 +416,12 @@ def manual_download(url, dst_dir, file_name, prefix=None):
|
|
411 |
command = ["aria2c"] + aria2_args.split() + ["-d", dst_dir, "-o", image_name, image_url]
|
412 |
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
413 |
|
414 |
-
elif 'github' in url or
|
415 |
-
file_name
|
|
|
|
|
|
|
|
|
416 |
|
417 |
""" Formatted info output """
|
418 |
try:
|
|
|
85 |
subprocess.run(install_cmd, shell=True, capture_output=True)
|
86 |
|
87 |
# Additional specific packages
|
88 |
+
with capture.capture_output():
|
89 |
get_ipython().system('curl -s -OL https://github.com/DEX-1101/sd-webui-notebook/raw/main/res/new_tunnel --output-dir {root_path}')
|
90 |
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')
|
91 |
get_ipython().system('curl -sLO https://github.com/openziti/zrok/releases/download/v0.4.32/zrok_0.4.32_linux_amd64.tar.gz && tar -xzf zrok_0.4.32_linux_amd64.tar.gz -C /usr/bin && rm -f zrok_0.4.32_linux_amd64.tar.gz')
|
|
|
320 |
model_type = data['files'][1]['type']
|
321 |
model_name = data['files'][1]['name']
|
322 |
|
323 |
+
if file_name and '.' not in file_name:
|
324 |
+
file_extension = model_name.split('.')[-1]
|
325 |
+
model_name = f"{file_name}.{file_extension}"
|
326 |
+
elif file_name:
|
327 |
+
model_name = file_name
|
328 |
+
|
329 |
return model_type, model_name
|
330 |
|
331 |
def get_download_url(data, model_type):
|
|
|
348 |
return None, None
|
349 |
|
350 |
model_type, model_name = get_model_info(url, data)
|
|
|
351 |
download_url = get_download_url(data, model_type)
|
352 |
image_url, image_name = get_image_info(data, model_type, model_name)
|
353 |
|
|
|
416 |
command = ["aria2c"] + aria2_args.split() + ["-d", dst_dir, "-o", image_name, image_url]
|
417 |
subprocess.run(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
418 |
|
419 |
+
elif 'github' in url or 'huggingface.co' in url:
|
420 |
+
if file_name and '.' not in file_name:
|
421 |
+
file_extension = f"{clean_url.split('/')[-1].split('.', 1)[1]}"
|
422 |
+
file_name = f"{file_name}.{file_extension}"
|
423 |
+
if not file_name:
|
424 |
+
file_name = clean_url.split("/")[-1]
|
425 |
|
426 |
""" Formatted info output """
|
427 |
try:
|