Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -29,6 +29,9 @@ model = torch.quantization.quantize_dynamic(
|
|
29 |
|
30 |
model = model.to(device)
|
31 |
|
|
|
|
|
|
|
32 |
processor = DPTImageProcessor.from_pretrained("Intel/dpt-swinv2-tiny-256")
|
33 |
|
34 |
color_map = cv2.applyColorMap(np.arange(256, dtype=np.uint8), cv2.COLORMAP_INFERNO)
|
@@ -52,7 +55,7 @@ def process_frame(image):
|
|
52 |
depth_map_colored = cv2.applyColorMap(depth_map, cv2.COLORMAP_INFERNO)
|
53 |
|
54 |
return cv2.cvtColor(depth_map_colored, cv2.COLOR_BGR2RGB)
|
55 |
-
|
56 |
interface = gr.Interface(
|
57 |
fn=process_frame,
|
58 |
inputs=gr.Image(sources="webcam", streaming=True),
|
|
|
29 |
|
30 |
model = model.to(device)
|
31 |
|
32 |
+
# Convert model to TorchScript
|
33 |
+
model = torch.jit.script(model)
|
34 |
+
|
35 |
processor = DPTImageProcessor.from_pretrained("Intel/dpt-swinv2-tiny-256")
|
36 |
|
37 |
color_map = cv2.applyColorMap(np.arange(256, dtype=np.uint8), cv2.COLORMAP_INFERNO)
|
|
|
55 |
depth_map_colored = cv2.applyColorMap(depth_map, cv2.COLORMAP_INFERNO)
|
56 |
|
57 |
return cv2.cvtColor(depth_map_colored, cv2.COLOR_BGR2RGB)
|
58 |
+
|
59 |
interface = gr.Interface(
|
60 |
fn=process_frame,
|
61 |
inputs=gr.Image(sources="webcam", streaming=True),
|