Chao Xu commited on
Commit
cf4af5e
β€’
1 Parent(s): 04f27a5

fix slider bug and adjust examples

Browse files
Files changed (37) hide show
  1. app.py +5 -3
  2. demo_examples/01_wild_hydrant.png +2 -2
  3. demo_examples/03_wild2_pineapple_bottle.png +2 -2
  4. demo_examples/04_unsplash_broccoli.png +2 -2
  5. demo_examples/{14_dalle3_gramophone1.png β†’ 05_objaverse_backpack.png} +2 -2
  6. demo_examples/05_unsplash_chocolatecake.png +0 -3
  7. demo_examples/{15_dalle3_mushroom2.png β†’ 06_unsplash_chocolatecake.png} +2 -2
  8. demo_examples/06_unsplash_stool2.png +0 -3
  9. demo_examples/{07_objaverse_backpack.png β†’ 07_unsplash_stool2.png} +2 -2
  10. demo_examples/08_dalle_icecream.png +2 -2
  11. demo_examples/{13_dalle_cowbear.png β†’ 10_dalle3_blueberryicecream2.png} +2 -2
  12. demo_examples/{10_GSO_Crosley_Alarm_Clock_Vintage_Metal.png β†’ 11_GSO_Crosley_Alarm_Clock_Vintage_Metal.png} +0 -0
  13. demo_examples/{11_realfusion_cactus_1.png β†’ 12_realfusion_cactus_1.png} +0 -0
  14. demo_examples/{12_realfusion_cherry_1.png β†’ 13_realfusion_cherry_1.png} +0 -0
  15. demo_examples/14_dalle_cowbear.png +3 -0
  16. demo_examples/15_dalle3_gramophone1.png +3 -0
  17. demo_examples/16_dalle3_blueberryicecream2.png +0 -3
  18. demo_examples/16_dalle3_mushroom2.png +3 -0
  19. demo_examples/17_dalle3_rockingchair1.png +2 -2
  20. demo_examples/18_dalle3_stump1.png +0 -3
  21. demo_examples/18_unsplash_mario.png +3 -0
  22. demo_examples/19_dalle3_stump1.png +3 -0
  23. demo_examples/{19_objaverse_stool.png β†’ 20_objaverse_stool.png} +0 -0
  24. demo_examples/21_unsplash_bigmac.png +2 -2
  25. demo_examples/22_unsplash_boxtoy.png +2 -2
  26. demo_examples/{20_objaverse_tank.png β†’ 23_objaverse_tank.png} +0 -0
  27. demo_examples/23_wild2_yellow_duck.png +0 -3
  28. demo_examples/24_unsplash_mario.png +0 -3
  29. demo_examples/24_wild2_yellow_duck.png +3 -0
  30. demo_examples/25_unsplash_ebicycle2.png +0 -3
  31. demo_examples/25_unsplash_teapot.png +3 -0
  32. demo_examples/26_unsplash_strawberrycake.png +2 -2
  33. demo_examples/28_GSO_Great_Dinos_Triceratops_Toy.png +0 -3
  34. demo_examples/28_wild_goose_chef.png +3 -0
  35. demo_examples/29_wild_goose_chef.png +0 -3
  36. demo_examples/29_wild_peroxide.png +3 -0
  37. demo_examples/30_wild_peroxide.png +0 -3
app.py CHANGED
@@ -430,9 +430,10 @@ def preprocess_run(predictor, models, raw_im, preprocess, *bbox_sliders):
430
  def on_coords_slider(image, x_min, y_min, x_max, y_max, color=(88, 191, 131, 255)):
431
  """Draw a bounding box annotation for an image."""
432
  print("on_coords_slider, drawing bbox...")
 
433
  image_size = image.size
434
- if max(image_size) > 180:
435
- image.thumbnail([180, 180], Image.Resampling.LANCZOS)
436
  shrink_ratio = max(image.size) / max(image_size)
437
  x_min = int(x_min * shrink_ratio)
438
  y_min = int(y_min * shrink_ratio)
@@ -455,7 +456,7 @@ def init_bbox(image):
455
  x_max = int(x_nonzero[0].max())
456
  y_max = int(y_nonzero[0].max())
457
  image_mini = image.copy()
458
- image_mini.thumbnail([180, 180], Image.Resampling.LANCZOS)
459
  shrink_ratio = max(image_mini.size) / max(width, height)
460
  x_min_shrink = int(x_min * shrink_ratio)
461
  y_min_shrink = int(y_min * shrink_ratio)
@@ -506,6 +507,7 @@ def run_demo(
506
  outputs=[image_block],
507
  cache_examples=False,
508
  label='Examples (click one of the images below to start)',
 
509
  )
510
 
511
  with gr.Accordion('Advanced options', open=False):
 
430
  def on_coords_slider(image, x_min, y_min, x_max, y_max, color=(88, 191, 131, 255)):
431
  """Draw a bounding box annotation for an image."""
432
  print("on_coords_slider, drawing bbox...")
433
+ image.thumbnail([512, 512], Image.Resampling.LANCZOS)
434
  image_size = image.size
435
+ if max(image_size) > 224:
436
+ image.thumbnail([224, 224], Image.Resampling.LANCZOS)
437
  shrink_ratio = max(image.size) / max(image_size)
438
  x_min = int(x_min * shrink_ratio)
439
  y_min = int(y_min * shrink_ratio)
 
456
  x_max = int(x_nonzero[0].max())
457
  y_max = int(y_nonzero[0].max())
458
  image_mini = image.copy()
459
+ image_mini.thumbnail([224, 224], Image.Resampling.LANCZOS)
460
  shrink_ratio = max(image_mini.size) / max(width, height)
461
  x_min_shrink = int(x_min * shrink_ratio)
462
  y_min_shrink = int(y_min * shrink_ratio)
 
507
  outputs=[image_block],
508
  cache_examples=False,
509
  label='Examples (click one of the images below to start)',
510
+ examples_per_page=40
511
  )
512
 
513
  with gr.Accordion('Advanced options', open=False):
demo_examples/01_wild_hydrant.png CHANGED

Git LFS Details

  • SHA256: 415f971861f42fc3ee8a58587b03f50816281f64ddc72ffd1924f6710d05fa12
  • Pointer size: 132 Bytes
  • Size of remote file: 5.52 MB

Git LFS Details

  • SHA256: 3c523613f3a178acd2cbdc82635674de91060523094ce304b1707202f850e2bc
  • Pointer size: 131 Bytes
  • Size of remote file: 530 kB
demo_examples/03_wild2_pineapple_bottle.png CHANGED

Git LFS Details

  • SHA256: f3fe184da1dc7591f7beccbba368606dbf74374e7e4d34c90ebf53d964d27783
  • Pointer size: 133 Bytes
  • Size of remote file: 13.7 MB

Git LFS Details

  • SHA256: e37757de125a25d76d72bb3b4ad535931fc1691a740a330cf1e02c2c772cf639
  • Pointer size: 131 Bytes
  • Size of remote file: 402 kB
demo_examples/04_unsplash_broccoli.png CHANGED

Git LFS Details

  • SHA256: 9ddc9cc9f62284b6c3552f47e26998c04230369027feede859be9237bdba97ac
  • Pointer size: 131 Bytes
  • Size of remote file: 618 kB

Git LFS Details

  • SHA256: 0342affecfd2626bae0238cf07c7aa173ec8a99e9eba02381334dc44d62b558f
  • Pointer size: 131 Bytes
  • Size of remote file: 275 kB
demo_examples/{14_dalle3_gramophone1.png β†’ 05_objaverse_backpack.png} RENAMED
File without changes
demo_examples/05_unsplash_chocolatecake.png DELETED

Git LFS Details

  • SHA256: 50f0bedd57accb5ad31003c22a79b78d6b06fb28d27b5519fed3dcc3d089c194
  • Pointer size: 132 Bytes
  • Size of remote file: 3.95 MB
demo_examples/{15_dalle3_mushroom2.png β†’ 06_unsplash_chocolatecake.png} RENAMED
File without changes
demo_examples/06_unsplash_stool2.png DELETED

Git LFS Details

  • SHA256: 7c4ba5b6b44d62f634e59ecd9c581551c1d1526ed07f8a8d6a62eb462b205ab1
  • Pointer size: 132 Bytes
  • Size of remote file: 5.94 MB
demo_examples/{07_objaverse_backpack.png β†’ 07_unsplash_stool2.png} RENAMED
File without changes
demo_examples/08_dalle_icecream.png CHANGED

Git LFS Details

  • SHA256: 788299dd88bb8bf0f3efc725a7abe9887e2c0edf73c6cf55625cf5b3eac3a92b
  • Pointer size: 130 Bytes
  • Size of remote file: 55.6 kB

Git LFS Details

  • SHA256: 8c814423ff2dbac089485b35d9b350a855ab18f8d422dee25e3f5e5f6bd7eb1e
  • Pointer size: 131 Bytes
  • Size of remote file: 221 kB
demo_examples/{13_dalle_cowbear.png β†’ 10_dalle3_blueberryicecream2.png} RENAMED
File without changes
demo_examples/{10_GSO_Crosley_Alarm_Clock_Vintage_Metal.png β†’ 11_GSO_Crosley_Alarm_Clock_Vintage_Metal.png} RENAMED
File without changes
demo_examples/{11_realfusion_cactus_1.png β†’ 12_realfusion_cactus_1.png} RENAMED
File without changes
demo_examples/{12_realfusion_cherry_1.png β†’ 13_realfusion_cherry_1.png} RENAMED
File without changes
demo_examples/14_dalle_cowbear.png ADDED

Git LFS Details

  • SHA256: 1c6a510ebdea03448dadf4dff71a2cc3ce54e0a0328ee87ce0c1bbf6fbbca91d
  • Pointer size: 131 Bytes
  • Size of remote file: 284 kB
demo_examples/15_dalle3_gramophone1.png ADDED

Git LFS Details

  • SHA256: 54a802f0995b6ff64071b9b986650037be5fcd0d5b68626a4b468a5709cc0d29
  • Pointer size: 131 Bytes
  • Size of remote file: 277 kB
demo_examples/16_dalle3_blueberryicecream2.png DELETED

Git LFS Details

  • SHA256: 32bfbc3efb7462029fb9b449744d80f57d6235d3d48466812ea11c286d1bb0b6
  • Pointer size: 130 Bytes
  • Size of remote file: 64.9 kB
demo_examples/16_dalle3_mushroom2.png ADDED

Git LFS Details

  • SHA256: dd4f0cb7cd9b65489e8ccb2d23d76ec1caa29ebf7c1e0c1fc25fdd803e8ce9a4
  • Pointer size: 131 Bytes
  • Size of remote file: 352 kB
demo_examples/17_dalle3_rockingchair1.png CHANGED

Git LFS Details

  • SHA256: 0ffb0064a89db1425770c206810f4dd556464a2365dab04651e6edca3240e260
  • Pointer size: 130 Bytes
  • Size of remote file: 58.6 kB

Git LFS Details

  • SHA256: 6ad3eea0f2a98af1d5382787dda80c24b2061456ca8bde094cd9fc9308b178c3
  • Pointer size: 131 Bytes
  • Size of remote file: 230 kB
demo_examples/18_dalle3_stump1.png DELETED

Git LFS Details

  • SHA256: da47f2c42cef3c983629ea2f8119a8208aa6ca565ef647777191e5903af7c036
  • Pointer size: 130 Bytes
  • Size of remote file: 83.5 kB
demo_examples/18_unsplash_mario.png ADDED

Git LFS Details

  • SHA256: 55fd9facf435eda15d5636f001c78bbe9cee14b549672bc2eb86ae4dbe183e97
  • Pointer size: 131 Bytes
  • Size of remote file: 294 kB
demo_examples/19_dalle3_stump1.png ADDED

Git LFS Details

  • SHA256: 1e64cbbc88f310487f5b2f3ed2eb7d1cd859adf4653e10173033ddee6562151e
  • Pointer size: 131 Bytes
  • Size of remote file: 297 kB
demo_examples/{19_objaverse_stool.png β†’ 20_objaverse_stool.png} RENAMED
File without changes
demo_examples/21_unsplash_bigmac.png CHANGED

Git LFS Details

  • SHA256: 4cf620024f77d04115d5cff2793d5ba5de92d7491bc9b041cd4da3f25a597abb
  • Pointer size: 132 Bytes
  • Size of remote file: 2.15 MB

Git LFS Details

  • SHA256: c85bedd18f77f3574fbaa8ff296607f4fe17f36d0fd8a8c5ca262fdee9486f84
  • Pointer size: 131 Bytes
  • Size of remote file: 395 kB
demo_examples/22_unsplash_boxtoy.png CHANGED

Git LFS Details

  • SHA256: 47f020c3a1fc73420e7b82038da7549ce064579504e6c4beff454c8df34c6c45
  • Pointer size: 131 Bytes
  • Size of remote file: 642 kB

Git LFS Details

  • SHA256: 0d40a932892e3bd7076eb44cfe327e1e87ea00469cf1a120da746e6f3caef882
  • Pointer size: 131 Bytes
  • Size of remote file: 275 kB
demo_examples/{20_objaverse_tank.png β†’ 23_objaverse_tank.png} RENAMED
File without changes
demo_examples/23_wild2_yellow_duck.png DELETED

Git LFS Details

  • SHA256: 1688bed933585cf8a6264f769fc6b601dd734240402ca9c26a5c861e3d13659c
  • Pointer size: 133 Bytes
  • Size of remote file: 14.3 MB
demo_examples/24_unsplash_mario.png DELETED

Git LFS Details

  • SHA256: 452a6f4fe44943d30a306e8ece636eda09d0f46a9a0ab53eae6cab21e14be19d
  • Pointer size: 132 Bytes
  • Size of remote file: 1.37 MB
demo_examples/24_wild2_yellow_duck.png ADDED

Git LFS Details

  • SHA256: 5791f44bdf0487916eb3129539ae0bcaec1d3ebc825363b27aebfeeb2981643d
  • Pointer size: 131 Bytes
  • Size of remote file: 560 kB
demo_examples/25_unsplash_ebicycle2.png DELETED

Git LFS Details

  • SHA256: b4f97a8dae6cc895f63f2b5a00c7dcb5c326b2749e305485dada7303429b1b2e
  • Pointer size: 132 Bytes
  • Size of remote file: 2.75 MB
demo_examples/25_unsplash_teapot.png ADDED

Git LFS Details

  • SHA256: 70e67ae75c14fc60beddceafbce0ad81a5142b17378531b880ae9858fae51483
  • Pointer size: 131 Bytes
  • Size of remote file: 255 kB
demo_examples/26_unsplash_strawberrycake.png CHANGED

Git LFS Details

  • SHA256: 2045c9901b2e65679e16f74f736aeabb316f98c0f883c02219ddafdaddab64f0
  • Pointer size: 132 Bytes
  • Size of remote file: 1.47 MB

Git LFS Details

  • SHA256: 3db1f8ebc29f3ea89fb16a9202d9659ddac447a85ef015e7a5b731178a076ddd
  • Pointer size: 131 Bytes
  • Size of remote file: 198 kB
demo_examples/28_GSO_Great_Dinos_Triceratops_Toy.png DELETED

Git LFS Details

  • SHA256: ad6c1fc3c619e9fa9109af90db2df069280ec669c4a3b075d399b293e8bf03df
  • Pointer size: 130 Bytes
  • Size of remote file: 29.2 kB
demo_examples/28_wild_goose_chef.png ADDED

Git LFS Details

  • SHA256: 7a3fc54c19e7ddf9d3c4796f597e96a373904cb6341c02a3676df92352837496
  • Pointer size: 131 Bytes
  • Size of remote file: 274 kB
demo_examples/29_wild_goose_chef.png DELETED

Git LFS Details

  • SHA256: e3a7a7574e9a6bb63014333ff45ea20fb059990869cebb6a7438878fbdca5c8f
  • Pointer size: 133 Bytes
  • Size of remote file: 11.8 MB
demo_examples/29_wild_peroxide.png ADDED

Git LFS Details

  • SHA256: 6d30acf4216ca9cc9531d630881047c6864c5359f53685101547311d99b6a38f
  • Pointer size: 131 Bytes
  • Size of remote file: 238 kB
demo_examples/30_wild_peroxide.png DELETED

Git LFS Details

  • SHA256: 2c76634e8dc370f334080140778a5d3339cad7b7e967e8631650f33378f44a4c
  • Pointer size: 133 Bytes
  • Size of remote file: 10.3 MB