bupa1018 commited on
Commit
4a8e6b0
·
1 Parent(s): 17b0cb4

Update download_repo.py

Browse files
Files changed (1) hide show
  1. download_repo.py +5 -2
download_repo.py CHANGED
@@ -11,8 +11,8 @@ def download_gitlab_repo_to_hfspace(api_url, project_id, version, target_folder)
11
  url = f"{api_url}/projects/{encoded_project_id}/repository/archive.zip?sha={version}"
12
 
13
  # Send GET request to download the zip file
14
- response = requests.get(url, stream=True)
15
-
16
  content_disposition = response.headers.get('content-disposition')
17
  if content_disposition:
18
  filename = content_disposition.split('filename=')[-1].strip('\"')
@@ -42,6 +42,9 @@ def download_gitlab_repo_to_hfspace(api_url, project_id, version, target_folder)
42
  print(f"An error occurred: {e}")
43
 
44
 
 
 
 
45
  def _upload_file_to_hfspace(response, api, target_folder, HF_SPACE_NAME):
46
  archive_bytes = io.BytesIO(response.content)
47
  # Extract filename from content-disposition header
 
11
  url = f"{api_url}/projects/{encoded_project_id}/repository/archive.zip?sha={version}"
12
 
13
  # Send GET request to download the zip file
14
+ # response = requests.get(url, stream=True)
15
+ response = requests.get(archive_url)
16
  content_disposition = response.headers.get('content-disposition')
17
  if content_disposition:
18
  filename = content_disposition.split('filename=')[-1].strip('\"')
 
42
  print(f"An error occurred: {e}")
43
 
44
 
45
+
46
+
47
+
48
  def _upload_file_to_hfspace(response, api, target_folder, HF_SPACE_NAME):
49
  archive_bytes = io.BytesIO(response.content)
50
  # Extract filename from content-disposition header