Spaces:
Running
Running
edyoshikun
commited on
Commit
•
90ad424
1
Parent(s):
400cbe1
delete duplicated images and adding removing gpu dependency
Browse files
a549.png
DELETED
Binary file (107 kB)
|
|
app.py
CHANGED
@@ -11,6 +11,9 @@ class VSGradio:
|
|
11 |
def __init__(self, model_config, model_ckpt_path):
|
12 |
self.model_config = model_config
|
13 |
self.model_ckpt_path = model_ckpt_path
|
|
|
|
|
|
|
14 |
self.model = None
|
15 |
self.load_model()
|
16 |
|
@@ -20,10 +23,9 @@ class VSGradio:
|
|
20 |
self.model_ckpt_path,
|
21 |
architecture="UNeXt2_2D",
|
22 |
model_config=self.model_config,
|
23 |
-
accelerator="gpu",
|
24 |
)
|
|
|
25 |
self.model.eval()
|
26 |
-
self.model
|
27 |
|
28 |
def normalize_fov(self, input: ArrayLike):
|
29 |
"Normalizing the fov with zero mean and unit variance"
|
@@ -38,7 +40,7 @@ class VSGradio:
|
|
38 |
inp = torch.from_numpy(np.array(inp).astype(np.float32))
|
39 |
test_dict = dict(
|
40 |
index=None,
|
41 |
-
source=inp.unsqueeze(0).unsqueeze(0).unsqueeze(0).to(self.
|
42 |
)
|
43 |
with torch.inference_mode():
|
44 |
self.model.on_predict_start()
|
|
|
11 |
def __init__(self, model_config, model_ckpt_path):
|
12 |
self.model_config = model_config
|
13 |
self.model_ckpt_path = model_ckpt_path
|
14 |
+
self.device = torch.device(
|
15 |
+
"cuda" if torch.cuda.is_available() else "cpu"
|
16 |
+
) # Check if GPU is available
|
17 |
self.model = None
|
18 |
self.load_model()
|
19 |
|
|
|
23 |
self.model_ckpt_path,
|
24 |
architecture="UNeXt2_2D",
|
25 |
model_config=self.model_config,
|
|
|
26 |
)
|
27 |
+
self.model.to(self.device)
|
28 |
self.model.eval()
|
|
|
29 |
|
30 |
def normalize_fov(self, input: ArrayLike):
|
31 |
"Normalizing the fov with zero mean and unit variance"
|
|
|
40 |
inp = torch.from_numpy(np.array(inp).astype(np.float32))
|
41 |
test_dict = dict(
|
42 |
index=None,
|
43 |
+
source=inp.unsqueeze(0).unsqueeze(0).unsqueeze(0).to(self.device),
|
44 |
)
|
45 |
with torch.inference_mode():
|
46 |
self.model.on_predict_start()
|
hek.png
DELETED
Binary file (98.1 kB)
|
|