Spaces:
Running
Running
CPU only
Browse files- gradio_app.py +5 -7
gradio_app.py
CHANGED
|
@@ -5,7 +5,6 @@ import torch
|
|
| 5 |
import torch.nn.functional as F
|
| 6 |
import os
|
| 7 |
import time
|
| 8 |
-
import spaces
|
| 9 |
import subprocess
|
| 10 |
|
| 11 |
from dataloader.stereo import transforms
|
|
@@ -103,8 +102,8 @@ class MatchStereoDemo:
|
|
| 103 |
if self.model is None:
|
| 104 |
return
|
| 105 |
|
| 106 |
-
dummy_left = torch.randn(1, 3,
|
| 107 |
-
dummy_right = torch.randn(1, 3,
|
| 108 |
|
| 109 |
with torch.no_grad():
|
| 110 |
_ = self.model(dummy_left, dummy_right, stereo=(self.current_mode == 'stereo'))
|
|
@@ -138,12 +137,11 @@ class MatchStereoDemo:
|
|
| 138 |
"720P": (round_to_32(1280), round_to_32(720)),
|
| 139 |
"1080P": (round_to_32(1920), round_to_32(1080)),
|
| 140 |
"2K": (round_to_32(2048), round_to_32(1080)),
|
| 141 |
-
"4K UHD": (round_to_32(3840), round_to_32(2160))
|
| 142 |
}
|
| 143 |
|
| 144 |
return size_presets.get(size_name, None)
|
| 145 |
|
| 146 |
-
@spaces.GPU
|
| 147 |
def process_images(self, left_image, right_image, mode, variant,
|
| 148 |
low_res_init=False, inference_size_name="Original",
|
| 149 |
precision="fp32", mat_impl="pytorch"):
|
|
@@ -373,9 +371,9 @@ with gr.Blocks(title="MatchStereo/MatchFlow Demo") as demo:
|
|
| 373 |
interactive=current_has_cuda
|
| 374 |
)
|
| 375 |
mat_impl = gr.Radio(
|
| 376 |
-
choices=["
|
| 377 |
label="MatchAttention Implementation",
|
| 378 |
-
value="
|
| 379 |
info="MatchAttention implementations",
|
| 380 |
interactive=current_has_cuda
|
| 381 |
)
|
|
|
|
| 5 |
import torch.nn.functional as F
|
| 6 |
import os
|
| 7 |
import time
|
|
|
|
| 8 |
import subprocess
|
| 9 |
|
| 10 |
from dataloader.stereo import transforms
|
|
|
|
| 102 |
if self.model is None:
|
| 103 |
return
|
| 104 |
|
| 105 |
+
dummy_left = torch.randn(1, 3, 256, 256, device=self.device, dtype=self.dtype)
|
| 106 |
+
dummy_right = torch.randn(1, 3, 256, 256, device=self.device, dtype=self.dtype)
|
| 107 |
|
| 108 |
with torch.no_grad():
|
| 109 |
_ = self.model(dummy_left, dummy_right, stereo=(self.current_mode == 'stereo'))
|
|
|
|
| 137 |
"720P": (round_to_32(1280), round_to_32(720)),
|
| 138 |
"1080P": (round_to_32(1920), round_to_32(1080)),
|
| 139 |
"2K": (round_to_32(2048), round_to_32(1080)),
|
| 140 |
+
## "4K UHD": (round_to_32(3840), round_to_32(2160))
|
| 141 |
}
|
| 142 |
|
| 143 |
return size_presets.get(size_name, None)
|
| 144 |
|
|
|
|
| 145 |
def process_images(self, left_image, right_image, mode, variant,
|
| 146 |
low_res_init=False, inference_size_name="Original",
|
| 147 |
precision="fp32", mat_impl="pytorch"):
|
|
|
|
| 371 |
interactive=current_has_cuda
|
| 372 |
)
|
| 373 |
mat_impl = gr.Radio(
|
| 374 |
+
choices=["pytorch", "cuda"],
|
| 375 |
label="MatchAttention Implementation",
|
| 376 |
+
value="pytorch",
|
| 377 |
info="MatchAttention implementations",
|
| 378 |
interactive=current_has_cuda
|
| 379 |
)
|