Spaces:
Sleeping
Sleeping
File size: 462 Bytes
9439b9b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
from io import BytesIO
from typing import List
from zipfile import ZipFile
from urllib.request import urlopen
import os
def download_and_extract(remote_model_url: str, local_model_dir) -> List[str]:
resp = urlopen(remote_model_url)
os.makedirs(local_model_dir, exist_ok=True)
with ZipFile(BytesIO(resp.read())) as zip_file:
all_files_and_dirs = zip_file.namelist()
zip_file.extractall(local_model_dir)
return all_files_and_dirs
|