Fix depth map indexing and streamline output messages
Browse filesCorrected the depth map indexing by swapping x and y for proper data retrieval. Commented out visualization flag in test data and simplified printed output to focus on the retrieved depth value.
- handler.py +1 -1
- test_hf.py +3 -3
handler.py
CHANGED
|
@@ -117,7 +117,7 @@ class EndpointHandler:
|
|
| 117 |
}
|
| 118 |
else:
|
| 119 |
result = {
|
| 120 |
-
"deph": depth_map[
|
| 121 |
# "depth": normalized_depth.tolist(),
|
| 122 |
# "depth": compressed_depth_base64,
|
| 123 |
# "depth_map": depth_map,
|
|
|
|
| 117 |
}
|
| 118 |
else:
|
| 119 |
result = {
|
| 120 |
+
"deph": depth_map[y][x]
|
| 121 |
# "depth": normalized_depth.tolist(),
|
| 122 |
# "depth": compressed_depth_base64,
|
| 123 |
# "depth_map": depth_map,
|
test_hf.py
CHANGED
|
@@ -39,7 +39,7 @@ payload = {
|
|
| 39 |
|
| 40 |
},
|
| 41 |
"url" : "https://images.unsplash.com/photo-1586023492125-27b2c045efd7?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aW50ZXJpb3IlMjBkZXNpZ258ZW58MHx8MHx8fDA%3D",
|
| 42 |
-
"visualization": False,
|
| 43 |
"x": 80,
|
| 44 |
"y": 60
|
| 45 |
|
|
@@ -59,8 +59,8 @@ if response.status_code == 200:
|
|
| 59 |
with open("depth_visualization.png", "wb") as f:
|
| 60 |
f.write(vis_bytes)
|
| 61 |
print("Visualizaci贸n guardada como 'depth_visualization.png'")
|
| 62 |
-
print(f"Profundidad
|
| 63 |
-
|
| 64 |
else:
|
| 65 |
print(f"Error: {response.status_code}")
|
| 66 |
print(response.text)
|
|
|
|
| 39 |
|
| 40 |
},
|
| 41 |
"url" : "https://images.unsplash.com/photo-1586023492125-27b2c045efd7?fm=jpg&q=60&w=3000&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8Mnx8aW50ZXJpb3IlMjBkZXNpZ258ZW58MHx8MHx8fDA%3D",
|
| 42 |
+
# "visualization": False,
|
| 43 |
"x": 80,
|
| 44 |
"y": 60
|
| 45 |
|
|
|
|
| 59 |
with open("depth_visualization.png", "wb") as f:
|
| 60 |
f.write(vis_bytes)
|
| 61 |
print("Visualizaci贸n guardada como 'depth_visualization.png'")
|
| 62 |
+
print(f"Profundidad: {result.get('deph')}")
|
| 63 |
+
|
| 64 |
else:
|
| 65 |
print(f"Error: {response.status_code}")
|
| 66 |
print(response.text)
|