Spaces:
Runtime error
Runtime error
Create download.py
Browse files- download.py +24 -0
download.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gdown
|
| 3 |
+
import zipfile
|
| 4 |
+
|
| 5 |
+
def download_files_from_url():
|
| 6 |
+
os.makedirs('/tmp/stf',exist_ok=True)
|
| 7 |
+
os.makedirs('/tmp/stf/TEMP',exist_ok=True)
|
| 8 |
+
|
| 9 |
+
file_id=os.getenv('DOWNLOAD_1')
|
| 10 |
+
url = f"https://drive.google.com/uc?id={file_id}"
|
| 11 |
+
gdown.download(url, '/tmp/stf-api-alternative.zip', quiet=False)
|
| 12 |
+
zipfile.ZipFile('/tmp/stf-api-alternative.zip', 'r').extractall('/tmp/stf/')
|
| 13 |
+
|
| 14 |
+
file_id=os.getenv('DOWNLOAD_2')
|
| 15 |
+
url = f"https://drive.google.com/uc?id={file_id}"
|
| 16 |
+
gdown.download(url, '/tmp/stf/089.pth', quiet=False)
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
file_id=os.getenv('DOWNLOAD_3')
|
| 20 |
+
url = f"https://drive.google.com/uc?id={file_id}"
|
| 21 |
+
gdown.download(url, '/tmp/stf/TEMP/0157.pth', quiet=False)
|
| 22 |
+
|
| 23 |
+
os.remove('/tmp/stf-api-alternative.zip')
|
| 24 |
+
|