mirror of
https://github.com/gcorso/DiffDock.git
synced 2026-06-04 18:04:23 +08:00
Also add web app code for simple gradio app. Refine requirements.txt/environment.yml. Automatically download models if not present.
15 lines
462 B
Python
15 lines
462 B
Python
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
|