eienmojiki commited on
Commit
b8d3abf
·
verified ·
1 Parent(s): df0e349

Update utils/download_utils.py

Browse files
Files changed (1) hide show
  1. utils/download_utils.py +4 -8
utils/download_utils.py CHANGED
@@ -1,7 +1,7 @@
1
  def download_things(
2
  directory: str,
3
  url: str,
4
- hf_token: str = "",
5
  civitai_api_key: str = ""):
6
  """
7
  :param directory: String, directory to save the downloaded file
@@ -22,13 +22,9 @@ def download_things(
22
  # url = urllib.parse.quote(url, safe=':/') # fix encoding
23
  if "/blob/" in url:
24
  url = url.replace("/blob/", "/resolve/")
25
- user_header = f'"Authorization: Bearer {hf_token}"'
26
- if hf_token:
27
- os.system(
28
- 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]}")
29
- else:
30
- os.system(
31
- f"aria2c --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -x 16 -k "
32
  f"1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
33
  elif "civitai.com" in url:
34
  if "?" in url:
 
1
  def download_things(
2
  directory: str,
3
  url: str,
4
+ # hf_token: str = "",
5
  civitai_api_key: str = ""):
6
  """
7
  :param directory: String, directory to save the downloaded file
 
22
  # url = urllib.parse.quote(url, safe=':/') # fix encoding
23
  if "/blob/" in url:
24
  url = url.replace("/blob/", "/resolve/")
25
+
26
+ os.system(
27
+ f"aria2c --load-cookies='./cookies.txt' --optimize-concurrent-downloads --console-log-level=error --summary-interval=10 -c -x 16 -k "
 
 
 
 
28
  f"1M -s 16 {url} -d {directory} -o {url.split('/')[-1]}")
29
  elif "civitai.com" in url:
30
  if "?" in url: