forked from kiri-art/banana-upsample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
download.py
31 lines (25 loc) · 1.02 KB
/
download.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# In this file, we define download_model
# It runs during container build time to get model weights built into the container
import os
import requests
from models import models_by_type
def download_model():
os.makedirs("weights", exist_ok=True)
for type in models_by_type:
models = models_by_type[type]
for model_key in models:
model = models[model_key]
print(model)
response = requests.get(model["weights"])
open(model["path"], "wb").write(response.content)
os.makedirs("/gfpgan/weights")
response = requests.get(
"https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth"
)
open("/gfpgan/weights/detection_Resnet50_Final.pth", "wb").write(response.content)
response = requests.get(
"https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth"
)
open("/gfpgan/weights/parsing_parsenet.pth", "wb").write(response.content)
if __name__ == "__main__":
download_model()