xhk commited on
Commit
84b6050
1 Parent(s): 17a160a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -246,8 +246,12 @@ def run_grounded_sam(input_image, text_prompt, task_type, box_threshold, text_th
246
  x_min, y_min, x_max, y_max = 250, 25, 774, 803
247
  elif id == -1572157: #example 9 *
248
  x_min, y_min, x_max, y_max = 15, 88, 1006, 977
 
 
 
 
249
  else:
250
- print("not defined")
251
  raise NotImplementedError
252
  bbox = np.array([x_min, y_min, x_max, y_max])
253
  bbox = torch.tensor(bbox).unsqueeze(0)
@@ -502,7 +506,11 @@ if __name__ == "__main__":
502
  with gr.Column():
503
  gr.Examples(["example8.jpg"], inputs=input_image)
504
  with gr.Column():
505
- gr.Examples(["example9.jpg"], inputs=input_image)
 
 
 
 
506
  run_button.click(fn=run_grounded_sam, inputs=[
507
  input_image, text_prompt, task_type, box_threshold, text_threshold, iou_threshold], outputs=[gallery1,gallery2])
508
 
 
246
  x_min, y_min, x_max, y_max = 250, 25, 774, 803
247
  elif id == -1572157: #example 9 *
248
  x_min, y_min, x_max, y_max = 15, 88, 1006, 977
249
+ elif id == -509470: #example 10
250
+ x_min, y_min, x_max, y_max = 190, 0, 530, 395
251
+ elif id == -42440: #example 11
252
+ x_min, y_min, x_max, y_max = 282, 134, 534, 394
253
  else:
254
+ print(id, "not defined")
255
  raise NotImplementedError
256
  bbox = np.array([x_min, y_min, x_max, y_max])
257
  bbox = torch.tensor(bbox).unsqueeze(0)
 
506
  with gr.Column():
507
  gr.Examples(["example8.jpg"], inputs=input_image)
508
  with gr.Column():
509
+ gr.Examples(["example9.jpg"], inputs=input_image)
510
+ with gr.Column():
511
+ gr.Examples(["example10.jpg"], inputs=input_image)
512
+ with gr.Column():
513
+ gr.Examples(["example11.jpg"], inputs=input_image)
514
  run_button.click(fn=run_grounded_sam, inputs=[
515
  input_image, text_prompt, task_type, box_threshold, text_threshold, iou_threshold], outputs=[gallery1,gallery2])
516