orronai commited on
Commit
db2546f
·
1 Parent(s): 2ca8c63

feat: hide gallery scrollbar

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -164,6 +164,34 @@ css="""
164
  margin: 0 auto;
165
  max-width: 960px;
166
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  """
168
  with gr.Blocks(css=css) as demo:
169
  with gr.Column(elem_id="col-container"):
@@ -186,7 +214,7 @@ with gr.Blocks(css=css) as demo:
186
  with gr.Column():
187
  image_tar = gr.Gallery(
188
  label="Outputs", show_label=True, format="png",
189
- columns=[3], rows=[3], height="auto",
190
  )
191
  with gr.Accordion(label="Advanced Settings", open=False):
192
  src_guidance_scale = gr.Slider(value=1.0, minimum=0.0, maximum=15.0, label="src_guidance_scale", info="Source prompt CFG scale.")
 
164
  margin: 0 auto;
165
  max-width: 960px;
166
  }
167
+
168
+ #gallery-image img {
169
+ width: 100%; /* match column width */
170
+ height: auto; /* preserve aspect ratio */
171
+ object-fit: contain;
172
+ }
173
+
174
+ /* Hide thumbnails by default */
175
+ #gallery-image .gallery-container .preview .thumbnails {
176
+ opacity: 0;
177
+ transition: opacity 0.3s ease-in-out;
178
+ }
179
+
180
+ /* Show thumbnails only when hovering over the gallery */
181
+ #gallery-image:hover .gallery-container .preview .thumbnails {
182
+ opacity: 1;
183
+ }
184
+
185
+ /* Hide caption by default */
186
+ .gallery-container .preview .caption {
187
+ opacity: 0;
188
+ transition: opacity 0.3s ease-in-out;
189
+ }
190
+
191
+ /* Show caption when hovering over #gallery-image */
192
+ #gallery-image:hover .gallery-container .preview .caption {
193
+ opacity: 1;
194
+ }
195
  """
196
  with gr.Blocks(css=css) as demo:
197
  with gr.Column(elem_id="col-container"):
 
214
  with gr.Column():
215
  image_tar = gr.Gallery(
216
  label="Outputs", show_label=True, format="png",
217
+ columns=[3], rows=[3], height="auto", elem_id="gallery-image",
218
  )
219
  with gr.Accordion(label="Advanced Settings", open=False):
220
  src_guidance_scale = gr.Slider(value=1.0, minimum=0.0, maximum=15.0, label="src_guidance_scale", info="Source prompt CFG scale.")