John6666 commited on
Commit
4a4807f
1 Parent(s): 008c48b

Upload dc.py

Browse files
Files changed (1) hide show
  1. dc.py +1 -28
dc.py CHANGED
@@ -178,33 +178,6 @@ UPSCALER_DICT_GUI = {
178
 
179
  UPSCALER_KEYS = list(UPSCALER_DICT_GUI.keys())
180
 
181
- def download_things(directory, url, hf_token="", civitai_api_key=""):
182
- url = url.strip()
183
- if "drive.google.com" in url:
184
- original_dir = os.getcwd()
185
- os.chdir(directory)
186
- os.system(f"gdown --fuzzy {url}")
187
- os.chdir(original_dir)
188
- elif "huggingface.co" in url:
189
- url = url.replace("?download=true", "")
190
- # url = urllib.parse.quote(url, safe=':/') # fix encoding
191
- if "/blob/" in url:
192
- url = url.replace("/blob/", "/resolve/")
193
- user_header = f'"Authorization: Bearer {hf_token}"'
194
- if hf_token:
195
- os.system(f"aria2c --console-log-level=error --summary-interval=10 --header={user_header} -c -x 16 -k 1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
196
- else:
197
- os.system(f"aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -x 16 -k 1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
198
- elif "civitai.com" in url:
199
- if "?" in url:
200
- url = url.split("?")[0]
201
- if civitai_api_key:
202
- url = url + f"?token={civitai_api_key}"
203
- os.system(f"aria2c --console-log-level=error --summary-interval=10 -c -x 16 -k 1M -s 16 -d {directory} {url}")
204
- else:
205
- print("\033[91mYou need an API key to download Civitai models.\033[0m")
206
- else:
207
- os.system(f"aria2c --console-log-level=error --summary-interval=10 -c -x 16 -k 1M -s 16 -d {directory} {url}")
208
 
209
  def get_model_list(directory_path):
210
  model_list = []
@@ -221,7 +194,7 @@ def get_model_list(directory_path):
221
 
222
  ## BEGIN MOD
223
  from modutils import (to_list, list_uniq, list_sub, get_model_id_list, get_tupled_embed_list,
224
- get_tupled_model_list, get_lora_model_list, download_private_repo)
225
 
226
  # - **Download Models**
227
  download_model = ", ".join(download_model_list)
 
178
 
179
  UPSCALER_KEYS = list(UPSCALER_DICT_GUI.keys())
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
 
182
  def get_model_list(directory_path):
183
  model_list = []
 
194
 
195
  ## BEGIN MOD
196
  from modutils import (to_list, list_uniq, list_sub, get_model_id_list, get_tupled_embed_list,
197
+ get_tupled_model_list, get_lora_model_list, download_private_repo, download_things)
198
 
199
  # - **Download Models**
200
  download_model = ", ".join(download_model_list)