Spaces:
Paused
Paused
Chao Xu
commited on
Commit
β’
cf4af5e
1
Parent(s):
04f27a5
fix slider bug and adjust examples
Browse files- app.py +5 -3
- demo_examples/01_wild_hydrant.png +2 -2
- demo_examples/03_wild2_pineapple_bottle.png +2 -2
- demo_examples/04_unsplash_broccoli.png +2 -2
- demo_examples/{14_dalle3_gramophone1.png β 05_objaverse_backpack.png} +2 -2
- demo_examples/05_unsplash_chocolatecake.png +0 -3
- demo_examples/{15_dalle3_mushroom2.png β 06_unsplash_chocolatecake.png} +2 -2
- demo_examples/06_unsplash_stool2.png +0 -3
- demo_examples/{07_objaverse_backpack.png β 07_unsplash_stool2.png} +2 -2
- demo_examples/08_dalle_icecream.png +2 -2
- demo_examples/{13_dalle_cowbear.png β 10_dalle3_blueberryicecream2.png} +2 -2
- demo_examples/{10_GSO_Crosley_Alarm_Clock_Vintage_Metal.png β 11_GSO_Crosley_Alarm_Clock_Vintage_Metal.png} +0 -0
- demo_examples/{11_realfusion_cactus_1.png β 12_realfusion_cactus_1.png} +0 -0
- demo_examples/{12_realfusion_cherry_1.png β 13_realfusion_cherry_1.png} +0 -0
- demo_examples/14_dalle_cowbear.png +3 -0
- demo_examples/15_dalle3_gramophone1.png +3 -0
- demo_examples/16_dalle3_blueberryicecream2.png +0 -3
- demo_examples/16_dalle3_mushroom2.png +3 -0
- demo_examples/17_dalle3_rockingchair1.png +2 -2
- demo_examples/18_dalle3_stump1.png +0 -3
- demo_examples/18_unsplash_mario.png +3 -0
- demo_examples/19_dalle3_stump1.png +3 -0
- demo_examples/{19_objaverse_stool.png β 20_objaverse_stool.png} +0 -0
- demo_examples/21_unsplash_bigmac.png +2 -2
- demo_examples/22_unsplash_boxtoy.png +2 -2
- demo_examples/{20_objaverse_tank.png β 23_objaverse_tank.png} +0 -0
- demo_examples/23_wild2_yellow_duck.png +0 -3
- demo_examples/24_unsplash_mario.png +0 -3
- demo_examples/24_wild2_yellow_duck.png +3 -0
- demo_examples/25_unsplash_ebicycle2.png +0 -3
- demo_examples/25_unsplash_teapot.png +3 -0
- demo_examples/26_unsplash_strawberrycake.png +2 -2
- demo_examples/28_GSO_Great_Dinos_Triceratops_Toy.png +0 -3
- demo_examples/28_wild_goose_chef.png +3 -0
- demo_examples/29_wild_goose_chef.png +0 -3
- demo_examples/29_wild_peroxide.png +3 -0
- 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) >
|
435 |
-
image.thumbnail([
|
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([
|
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
|
Git LFS Details
|
demo_examples/03_wild2_pineapple_bottle.png
CHANGED
Git LFS Details
|
Git LFS Details
|
demo_examples/04_unsplash_broccoli.png
CHANGED
Git LFS Details
|
Git LFS Details
|
demo_examples/{14_dalle3_gramophone1.png β 05_objaverse_backpack.png}
RENAMED
File without changes
|
demo_examples/05_unsplash_chocolatecake.png
DELETED
Git LFS Details
|
demo_examples/{15_dalle3_mushroom2.png β 06_unsplash_chocolatecake.png}
RENAMED
File without changes
|
demo_examples/06_unsplash_stool2.png
DELETED
Git LFS Details
|
demo_examples/{07_objaverse_backpack.png β 07_unsplash_stool2.png}
RENAMED
File without changes
|
demo_examples/08_dalle_icecream.png
CHANGED
Git LFS Details
|
Git LFS Details
|
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
|
demo_examples/15_dalle3_gramophone1.png
ADDED
Git LFS Details
|
demo_examples/16_dalle3_blueberryicecream2.png
DELETED
Git LFS Details
|
demo_examples/16_dalle3_mushroom2.png
ADDED
Git LFS Details
|
demo_examples/17_dalle3_rockingchair1.png
CHANGED
Git LFS Details
|
Git LFS Details
|
demo_examples/18_dalle3_stump1.png
DELETED
Git LFS Details
|
demo_examples/18_unsplash_mario.png
ADDED
Git LFS Details
|
demo_examples/19_dalle3_stump1.png
ADDED
Git LFS Details
|
demo_examples/{19_objaverse_stool.png β 20_objaverse_stool.png}
RENAMED
File without changes
|
demo_examples/21_unsplash_bigmac.png
CHANGED
Git LFS Details
|
Git LFS Details
|
demo_examples/22_unsplash_boxtoy.png
CHANGED
Git LFS Details
|
Git LFS Details
|
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
|
demo_examples/24_unsplash_mario.png
DELETED
Git LFS Details
|
demo_examples/24_wild2_yellow_duck.png
ADDED
Git LFS Details
|
demo_examples/25_unsplash_ebicycle2.png
DELETED
Git LFS Details
|
demo_examples/25_unsplash_teapot.png
ADDED
Git LFS Details
|
demo_examples/26_unsplash_strawberrycake.png
CHANGED
Git LFS Details
|
Git LFS Details
|
demo_examples/28_GSO_Great_Dinos_Triceratops_Toy.png
DELETED
Git LFS Details
|
demo_examples/28_wild_goose_chef.png
ADDED
Git LFS Details
|
demo_examples/29_wild_goose_chef.png
DELETED
Git LFS Details
|
demo_examples/29_wild_peroxide.png
ADDED
Git LFS Details
|
demo_examples/30_wild_peroxide.png
DELETED
Git LFS Details
|