Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,7 +47,7 @@ css = """
|
|
| 47 |
|
| 48 |
set_seed(666)
|
| 49 |
|
| 50 |
-
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 51 |
# DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 52 |
default_steps = 10
|
| 53 |
model = PixelPerfectDepth(sampling_steps=default_steps)
|
|
@@ -74,6 +74,7 @@ def main(share=True):
|
|
| 74 |
|
| 75 |
@(spaces.GPU if HUGGINFACE_SPACES_INSTALLED else (lambda x: x))
|
| 76 |
def predict_depth(image, denoise_steps):
|
|
|
|
| 77 |
global model
|
| 78 |
model = model.to(DEVICE)
|
| 79 |
depth, resize_image = model.infer_image(image, sampling_steps=denoise_steps)
|
|
@@ -81,6 +82,7 @@ def main(share=True):
|
|
| 81 |
|
| 82 |
@(spaces.GPU if HUGGINFACE_SPACES_INSTALLED else (lambda x: x))
|
| 83 |
def predict_moge_depth(image):
|
|
|
|
| 84 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 85 |
image = torch.tensor(image / 255, dtype=torch.float32, device=DEVICE).permute(2, 0, 1)
|
| 86 |
global moge_model
|
|
|
|
| 47 |
|
| 48 |
set_seed(666)
|
| 49 |
|
| 50 |
+
# DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 51 |
# DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
| 52 |
default_steps = 10
|
| 53 |
model = PixelPerfectDepth(sampling_steps=default_steps)
|
|
|
|
| 74 |
|
| 75 |
@(spaces.GPU if HUGGINFACE_SPACES_INSTALLED else (lambda x: x))
|
| 76 |
def predict_depth(image, denoise_steps):
|
| 77 |
+
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 78 |
global model
|
| 79 |
model = model.to(DEVICE)
|
| 80 |
depth, resize_image = model.infer_image(image, sampling_steps=denoise_steps)
|
|
|
|
| 82 |
|
| 83 |
@(spaces.GPU if HUGGINFACE_SPACES_INSTALLED else (lambda x: x))
|
| 84 |
def predict_moge_depth(image):
|
| 85 |
+
DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 86 |
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
|
| 87 |
image = torch.tensor(image / 255, dtype=torch.float32, device=DEVICE).permute(2, 0, 1)
|
| 88 |
global moge_model
|