sophiemaw commited on
Commit
7fc586c
·
verified ·
1 Parent(s): 989cc0e

Update load_models.py

Browse files
Files changed (1) hide show
  1. load_models.py +7 -1
load_models.py CHANGED
@@ -2,8 +2,8 @@ import sys
2
  import os
3
  import numpy as np
4
  import torch
5
- from ultralytics import YOLO
6
  from PIL import Image
 
7
 
8
  # StyleGAN2 dependencies
9
  sys.path.append("/Users/sophiemaw/stylegan2-ada")
@@ -20,6 +20,12 @@ def load_stylegan_model(
20
  ) -> None:
21
  global stylegan_generator
22
 
 
 
 
 
 
 
23
  print(f"🔄 Loading StyleGAN2 model from: {model_path}")
24
  with open(model_path, 'rb') as f:
25
  G = legacy.load_network_pkl(f)['G_ema'].to(device)
 
2
  import os
3
  import numpy as np
4
  import torch
 
5
  from PIL import Image
6
+ from huggingface_hub import hf_hub_download
7
 
8
  # StyleGAN2 dependencies
9
  sys.path.append("/Users/sophiemaw/stylegan2-ada")
 
20
  ) -> None:
21
  global stylegan_generator
22
 
23
+ print("⬇️ Downloading StyleGAN2 model from Hugging Face Hub...")
24
+ model_path = hf_hub_download(
25
+ repo_id="ZeqiangLai/StyleGAN2",
26
+ filename="stylegan2-ffhq-config-f.pkl"
27
+ )
28
+
29
  print(f"🔄 Loading StyleGAN2 model from: {model_path}")
30
  with open(model_path, 'rb') as f:
31
  G = legacy.load_network_pkl(f)['G_ema'].to(device)