Spaces:
Runtime error
Runtime error
Mehdi Cherti
commited on
Commit
·
ace1938
1
Parent(s):
af5ee77
update
Browse files
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 |
-
|
| 15 |
-
|
| 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)
|