Mehdi Cherti commited on
Commit
b5b3814
·
1 Parent(s): ba46911
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -8,10 +8,13 @@ from PIL import Image
8
  import torchvision
9
  from test_ddgan import load_model, sample
10
  from model_configs import get_model_config
11
- from huggingface_hub import hf_hub_download
12
 
13
  def download(filename):
14
- return "models/" + filename
 
 
 
15
 
16
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
17
  cache = {}
 
8
  import torchvision
9
  from test_ddgan import load_model, sample
10
  from model_configs import get_model_config
11
+ from subprocess import call
12
 
13
  def download(filename):
14
+ url = f"https://huggingface.co/spaces/mehdidc/text_to_image_ddgan/raw/main/models/{filename}"
15
+ if not os.path.exists(filename):
16
+ call("wget -O {filename} {url}".format(filename=filename, url=url), shell=True)
17
+ return filename
18
 
19
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
20
  cache = {}