Mehdi Cherti commited on
Commit
ace1938
1 Parent(s): af5ee77
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -11,11 +11,8 @@ 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
- call("ls models -l", shell=True)
18
- return filename
19
 
20
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
21
  cache = {}
@@ -25,6 +22,7 @@ def load(name):
25
  return cache[name]
26
  else:
27
  model_config, model_path = models[name]
 
28
  model = load_model(model_config, model_path, device=device)
29
  cache[name] = model
30
  return model
@@ -81,4 +79,4 @@ iface = gr.Interface(
81
  ],
82
  outputs="image"
83
  )
84
- iface.launch()
 
11
  from subprocess import call
12
 
13
  def download(filename):
14
+ return "models/" + filename
15
+
 
 
 
16
 
17
  device = 'cuda' if torch.cuda.is_available() else 'cpu'
18
  cache = {}
 
22
  return cache[name]
23
  else:
24
  model_config, model_path = models[name]
25
+ print(model_config, model_path)
26
  model = load_model(model_config, model_path, device=device)
27
  cache[name] = model
28
  return model
 
79
  ],
80
  outputs="image"
81
  )
82
+ iface.launch(debug=True)