Spaces:
Runtime error
Runtime error
Update download_repo_to_huggingface.py
Browse files
download_repo_to_huggingface.py
CHANGED
|
@@ -14,7 +14,7 @@ def download_and_upload_kadiAPY_repo_to_huggingfacespace(api_url, project_id, ve
|
|
| 14 |
response = requests.get(url, stream=True)
|
| 15 |
|
| 16 |
if response.status_code == 200:
|
| 17 |
-
|
| 18 |
else:
|
| 19 |
print(f"Failed to download the release: {response.status_code} - {response.reason}")
|
| 20 |
print(response.text)
|
|
@@ -27,7 +27,7 @@ def download_and_upload_kadiAPY_repo_to_huggingfacespace(api_url, project_id, ve
|
|
| 27 |
print(f"An error occurred: {e}")
|
| 28 |
|
| 29 |
|
| 30 |
-
def
|
| 31 |
"""Extracts the archive content and uploads the file."""
|
| 32 |
archive_bytes = io.BytesIO(response.content)
|
| 33 |
# Extract filename from content-disposition header
|
|
|
|
| 14 |
response = requests.get(url, stream=True)
|
| 15 |
|
| 16 |
if response.status_code == 200:
|
| 17 |
+
_extract_and_upload_file(response, api, DATA_DIR, HF_SPACE_NAME)
|
| 18 |
else:
|
| 19 |
print(f"Failed to download the release: {response.status_code} - {response.reason}")
|
| 20 |
print(response.text)
|
|
|
|
| 27 |
print(f"An error occurred: {e}")
|
| 28 |
|
| 29 |
|
| 30 |
+
def _extract_and_upload_file(response, api, DATA_DIR, HF_SPACE_NAME):
|
| 31 |
"""Extracts the archive content and uploads the file."""
|
| 32 |
archive_bytes = io.BytesIO(response.content)
|
| 33 |
# Extract filename from content-disposition header
|