test-stfzip / download.py
yerang's picture
Create download.py
2d0f335 verified
raw
history blame
814 Bytes
import os
import gdown
import zipfile
def download_files_from_url():
os.makedirs('/tmp/stf',exist_ok=True)
os.makedirs('/tmp/stf/TEMP',exist_ok=True)
file_id=os.getenv('DOWNLOAD_1')
url = f"https://drive.google.com/uc?id={file_id}"
gdown.download(url, '/tmp/stf-api-alternative.zip', quiet=False)
zipfile.ZipFile('/tmp/stf-api-alternative.zip', 'r').extractall('/tmp/stf/')
file_id=os.getenv('DOWNLOAD_2')
url = f"https://drive.google.com/uc?id={file_id}"
gdown.download(url, '/tmp/stf/089.pth', quiet=False)
file_id=os.getenv('DOWNLOAD_3')
url = f"https://drive.google.com/uc?id={file_id}"
gdown.download(url, '/tmp/stf/TEMP/0157.pth', quiet=False)
os.remove('/tmp/stf-api-alternative.zip')
if __name__=="__main__":
download_files_from_url()