Update app.py
Browse files462 unmodified lines4634644654664664674684694701 unmodified line47247347447547647747847547647748047847948048148348448548648248348448548848648748848949049149249349449549149249349449649749849649950050150250349950450550650750850951051151251350150250351451551651751851952052152252352452552652752850750850952953053153253353453553651451551653753853954054154254354451952052152252352454554654754854955055155255310 unmodified lines564565566541542543544545546567568569570571572573574575576577578579580581582583462 unmodified lines margin: 0 auto !important; justify-content: center !important; gap: 8px !important; min-height: 150px !important;}
.centered-examples .thumb { height: 100px !important; width: 100px !important;1 unmodified line margin: 5px !important;}
/* Universal solution - targets any element with both fixed-height and svelte classes */[class*="fixed-height"][class*="svelte-"] { min-height: 0 !important; max-height: 200px !important;/* Fix for gallery container - let it size to content */#my_media_gallery { height: auto !important; overflow-y: auto !important; min-height: auto !important; max-height: none !important;}
/* More specific for grid-wrap containers */[class*="grid-wrap"][class*="svelte-"][class*="fixed-height"] { min-height: 0 !important; max-height: 200px !important;/* Target the gallery grid wrapper specifically */#my_media_gallery [class*="grid-wrap"],#my_media_gallery .grid-wrap { height: auto !important; overflow-y: auto !important; min-height: auto !important; max-height: none !important; flex: none !important; display: grid !important; grid-template-columns: repeat(6, 1fr) !important; grid-auto-rows: min-content !important; gap: 8px !important; padding: 8px !important;}
/* Target gallery containers specifically */#my_media_gallery [class*="grid-wrap"] { min-height: 0 !important; max-height: 200px !important;/* Override any fixed-height constraints */[class*="fixed-height"][class*="svelte-"] { height: auto !important; overflow-y: auto !important; min-height: auto !important; max-height: none !important; flex: none !important;}
/* Media query version *//* Specific targeting for the gallery's parent containers */#my_media_gallery .svelte-vt1mxs,#my_media_gallery [class*="svelte-vt1mxs"] { height: auto !important; min-height: auto !important; flex: none !important;}
/* Ensure gallery doesn't shrink on wide screens */@media (min-width: 1280px) { [class*="fixed-height"][class*="svelte-"] { min-height: 0 !important; max-height: 200px !important; #my_media_gallery { height: auto !important; min-height: auto !important; max-height: none !important; flex: none !important; } #my_media_gallery [class*="grid-wrap"], #my_media_gallery .grid-wrap { height: auto !important; min-height: auto !important; max-height: none !important; flex: none !important; } [class*="grid-wrap"][class*="svelte-"][class*="fixed-height"] { min-height: 0 !important; max-height: 200px !important; [class*="fixed-height"][class*="svelte-"] { height: auto !important; min-height: auto !important; max-height: none !important; flex: none !important; }}
/* Fallback with even higher specificity */div[class*="fixed-height"][class*="svelte-"]:not([style*="min-height"]) { min-height: 0 !important;/* Force grid layout for proper image arrangement */#my_media_gallery [class*="grid-wrap"] > div { display: grid !important; grid-template-columns: repeat(6, minmax(100px, 1fr)) !important; gap: 8px !important; width: 100% !important;}
/* Target the specific gallery by ID */#my_media_gallery div[class*="grid-wrap"] { min-height: 0 !important; max-height: 200px !important; height: auto !important; overflow-y: auto !important;/* Ensure thumbnails maintain proper size */#my_media_gallery img,#my_media_gallery .thumbnail img { width: 100px !important; height: 100px !important; object-fit: cover !important;}"""
10 unmodified lines gr.Markdown("For Faster useage please download the files and run it locally (takes 20 seconds/translation on a 4080). On cpu it takes around 10 min/tranlation!") #inputs with gr.Column(scale=1): gallery = gr.Gallery(value=example_images, label="Example Images (Click to Select)", columns=6, allow_preview=False, elem_id="my_media_gallery", elem_classes=["centered-examples"]) gallery = gr.Gallery( value=example_images, label="Example Images (Click to Select)", columns=6, rows=None, # Let it auto-size based on content height="auto", # Auto height based on content allow_preview=False, container=False, # Remove container constraints elem_id="my_media_gallery", elem_classes=["centered-examples"], interactive=True, show_label=True, object_fit="cover" ) with gr.Row(scale=2): input_img = gr.Image(label="Input Image ") detection_img = gr.Image(label="Detection Image", interactive= False) app.py+72-38