Spaces:
Runtime error
Runtime error
Haobo Yuan
commited on
Commit
·
2fb6bea
1
Parent(s):
9cc3eb2
add device switcher
Browse files
main.py
CHANGED
|
@@ -36,7 +36,7 @@ examples = [
|
|
| 36 |
["app/assets/sa_235130.jpg"],
|
| 37 |
]
|
| 38 |
model = MODELS.build(model_cfg.model)
|
| 39 |
-
device = torch.device(
|
| 40 |
model = model.to(device=device)
|
| 41 |
model = model.eval()
|
| 42 |
model.init_weights()
|
|
|
|
| 36 |
["app/assets/sa_235130.jpg"],
|
| 37 |
]
|
| 38 |
model = MODELS.build(model_cfg.model)
|
| 39 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 40 |
model = model.to(device=device)
|
| 41 |
model = model.eval()
|
| 42 |
model.init_weights()
|