Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -65,19 +65,23 @@ def download_gitlab_project_by_version():
|
|
65 |
|
66 |
# Send GET request to download the zip file
|
67 |
response = requests.get(url, stream=True)
|
|
|
|
|
|
|
68 |
|
69 |
if response.status_code == 200:
|
70 |
# Extract filename from content-disposition header
|
71 |
content_disposition = response.headers.get("content-disposition")
|
72 |
if content_disposition and "filename=" in content_disposition:
|
73 |
filename = content_disposition.split("filename=")[-1].strip('"')
|
74 |
-
|
|
|
75 |
# target_path = f"{DATA_DIR}/{filename}"
|
76 |
|
77 |
# Check if the request was successful
|
78 |
if response.status_code == 200:
|
79 |
api.upload_file(
|
80 |
-
path_or_fileobj=
|
81 |
path_in_repo= f"{DATA_DIR}/{filename}",
|
82 |
repo_id=HF_SPACE_NAME,
|
83 |
repo_type='space'
|
|
|
65 |
|
66 |
# Send GET request to download the zip file
|
67 |
response = requests.get(url, stream=True)
|
68 |
+
archive_bytes = io.BytesIO(response.content)
|
69 |
+
|
70 |
+
print(archive_bytes)
|
71 |
|
72 |
if response.status_code == 200:
|
73 |
# Extract filename from content-disposition header
|
74 |
content_disposition = response.headers.get("content-disposition")
|
75 |
if content_disposition and "filename=" in content_disposition:
|
76 |
filename = content_disposition.split("filename=")[-1].strip('"')
|
77 |
+
print(filename)
|
78 |
+
|
79 |
# target_path = f"{DATA_DIR}/{filename}"
|
80 |
|
81 |
# Check if the request was successful
|
82 |
if response.status_code == 200:
|
83 |
api.upload_file(
|
84 |
+
path_or_fileobj= archive_bytes,
|
85 |
path_in_repo= f"{DATA_DIR}/{filename}",
|
86 |
repo_id=HF_SPACE_NAME,
|
87 |
repo_type='space'
|