Spaces:
Running
Running
use local images
Browse files- app.py +3 -5
- images/1-8ea4418f.jpg +0 -0
- images/276757975.jpg +0 -0
app.py
CHANGED
@@ -78,7 +78,6 @@ class InteractionDetector:
|
|
78 |
dist_y = np.abs(grid_y.T - joint[0])
|
79 |
dist_coord = dist_x + dist_y
|
80 |
|
81 |
-
|
82 |
depth_dist = np.abs(depth_map - depth_map[joint[1], joint[0]])
|
83 |
depth_dist[(segmentation_map == PERSON_ID) | (dist_coord > 50)] = 255
|
84 |
min_dist = np.unravel_index(np.argmin(depth_dist), depth_dist.shape)
|
@@ -146,7 +145,6 @@ class InteractionDetector:
|
|
146 |
right_cls, r_distance = self.get_nearest_pixel_class(right_hand[:2], depth_map, segmentation_map)
|
147 |
left_cls, l_distance = self.get_nearest_pixel_class(left_hand[:2], depth_map, segmentation_map)
|
148 |
|
149 |
-
|
150 |
# Check for interactions
|
151 |
right_touching = r_distance < self.interaction_threshold
|
152 |
left_touching = l_distance < self.interaction_threshold
|
@@ -223,7 +221,6 @@ class InteractionDetector:
|
|
223 |
info_text.append(f"Right hand distance to wall: {interaction['right_hand_distance']:.2f}")
|
224 |
info_text.append(f"Left hand distance to wall: {interaction['left_hand_distance']:.2f}")
|
225 |
|
226 |
-
|
227 |
# Add color to segmentation
|
228 |
mask = np.zeros((*segmentation_map.shape, 3), dtype=np.uint8)
|
229 |
colors = np.random.randint(0, 255, size=(100, 3))
|
@@ -267,14 +264,15 @@ def create_gradio_interface():
|
|
267 |
|
268 |
gr.Examples(
|
269 |
examples=[
|
270 |
-
"
|
271 |
-
"
|
272 |
],
|
273 |
inputs=input_image
|
274 |
)
|
275 |
|
276 |
return interface
|
277 |
|
|
|
278 |
interface = create_gradio_interface()
|
279 |
if __name__ == "__main__":
|
280 |
interface.launch(debug=True)
|
|
|
78 |
dist_y = np.abs(grid_y.T - joint[0])
|
79 |
dist_coord = dist_x + dist_y
|
80 |
|
|
|
81 |
depth_dist = np.abs(depth_map - depth_map[joint[1], joint[0]])
|
82 |
depth_dist[(segmentation_map == PERSON_ID) | (dist_coord > 50)] = 255
|
83 |
min_dist = np.unravel_index(np.argmin(depth_dist), depth_dist.shape)
|
|
|
145 |
right_cls, r_distance = self.get_nearest_pixel_class(right_hand[:2], depth_map, segmentation_map)
|
146 |
left_cls, l_distance = self.get_nearest_pixel_class(left_hand[:2], depth_map, segmentation_map)
|
147 |
|
|
|
148 |
# Check for interactions
|
149 |
right_touching = r_distance < self.interaction_threshold
|
150 |
left_touching = l_distance < self.interaction_threshold
|
|
|
221 |
info_text.append(f"Right hand distance to wall: {interaction['right_hand_distance']:.2f}")
|
222 |
info_text.append(f"Left hand distance to wall: {interaction['left_hand_distance']:.2f}")
|
223 |
|
|
|
224 |
# Add color to segmentation
|
225 |
mask = np.zeros((*segmentation_map.shape, 3), dtype=np.uint8)
|
226 |
colors = np.random.randint(0, 255, size=(100, 3))
|
|
|
264 |
|
265 |
gr.Examples(
|
266 |
examples=[
|
267 |
+
"images/1-8ea4418f.jpg",
|
268 |
+
"images/276757975.jpg"
|
269 |
],
|
270 |
inputs=input_image
|
271 |
)
|
272 |
|
273 |
return interface
|
274 |
|
275 |
+
|
276 |
interface = create_gradio_interface()
|
277 |
if __name__ == "__main__":
|
278 |
interface.launch(debug=True)
|
images/1-8ea4418f.jpg
ADDED
images/276757975.jpg
ADDED