rahulvenkk commited on
Commit
2d342bf
1 Parent(s): 4d601e2
app.py CHANGED
@@ -146,11 +146,14 @@ with gr.Blocks() as demo:
146
  with open('./assets/intervention_test_images/annot.json', 'r') as f:
147
  points_json = json.load(f)
148
 
 
 
 
 
 
149
  points_json = points_json[os.path.basename(img_path)]
150
 
151
  # print(f"Image uploaded with shape: {input.shape}")
152
- resized_img = resize_to_square(img)
153
-
154
  temp = resized_img.copy()
155
 
156
  # Redraw all remaining arrows and dots
 
146
  with open('./assets/intervention_test_images/annot.json', 'r') as f:
147
  points_json = json.load(f)
148
 
149
+ resized_img = resize_to_square(img)
150
+
151
+ if os.path.basename(img_path) not in points_json:
152
+ return resized_img, resized_img, img, []
153
+
154
  points_json = points_json[os.path.basename(img_path)]
155
 
156
  # print(f"Image uploaded with shape: {input.shape}")
 
 
157
  temp = resized_img.copy()
158
 
159
  # Redraw all remaining arrows and dots
assets/intervention_test_images/annot.json CHANGED
@@ -1 +1,16 @@
1
- {"bread.jpg": [[120, 257], [175, 269], [328, 375], [266, 353], [410, 217], [341, 248], [228, 149], [248, 211], [152, 129], [152, 129], [108, 51], [108, 51], [342, 39], [342, 39], [479, 93], [479, 93], [477, 390], [477, 390], [229, 486], [229, 486], [58, 442], [58, 442]]}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bread.jpg": [[120, 257], [175, 269], [328, 375], [266, 353], [410, 217], [341, 248], [228, 149], [248, 211], [152, 129], [152, 129], [108, 51], [108, 51], [342, 39], [342, 39], [479, 93], [479, 93], [477, 390], [477, 390], [229, 486], [229, 486], [58, 442], [58, 442]],
3
+
4
+ "bird.jpg": [[252, 284], [333, 279], [251, 213], [332, 209], [426, 379], [426, 379], [452, 116], [452, 116], [188, 66], [188, 66], [89, 436], [89, 436]],
5
+
6
+ "ducks.jpg": [[235, 385], [184, 433], [168, 131], [114, 174], [434, 27], [434, 27], [403, 187], [403, 187], [477, 336], [477, 336], [29, 426], [29, 426]],
7
+
8
+ "robot_arm.jpg": [[236, 236], [189, 275], [432, 125], [432, 125], [481, 304], [481, 304], [24, 419], [24, 419], [63, 111], [63, 111]],
9
+
10
+ "desk_1.jpg": [[167, 224], [127, 222], [272, 327], [290, 369], [383, 251], [407, 212], [53, 344], [53, 344], [86, 465], [86, 465], [476, 466], [476, 466], [475, 121], [475, 121], [277, 85], [277, 85]],
11
+
12
+ "glasses.jpg": [[217, 249], [302, 274], [245, 45], [245, 45], [282, 93], [282, 93], [431, 111], [431, 111], [467, 392], [467, 392], [89, 462], [89, 462], [30, 361], [30, 361]],
13
+
14
+ "watering_pot.jpg": [[239, 293], [309, 280], [454, 118], [469, 169], [425, 32], [425, 32], [466, 47], [466, 47], [383, 117], [383, 117], [495, 300], [495, 300], [304, 39], [304, 39], [34, 115], [34, 115], [94, 400], [94, 400], [281, 476], [281, 476]]
15
+
16
+ }