Sergidev commited on
Commit
b78371d
1 Parent(s): 3c21e52

history v1

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -215,10 +215,7 @@ generation_history = []
215
 
216
  # Function to update the history list
217
  def update_history_list():
218
- return [
219
- gr.Image.update(value=item["image"], visible=True)
220
- for item in generation_history
221
- ]
222
 
223
  # Function to handle image click in history
224
  def handle_image_click(evt: gr.SelectData):
@@ -357,11 +354,18 @@ with gr.Blocks(css="style.css") as demo:
357
  generate_from_json = gr.Button("Generate from JSON")
358
 
359
  # Add history accordion
360
- with gr.Accordion("Generation History", open=False) as history_accordion:
361
- history_gallery = gr.Gallery(label="History", show_label=False, elem_id="history_gallery").style(grid=5)
362
- with gr.Row():
363
- selected_image = gr.Image(label="Selected Image", interactive=False)
364
- selected_metadata = gr.JSON(label="Selected Metadata", show_label=False)
 
 
 
 
 
 
 
365
 
366
  gr.Examples(
367
  examples=config.examples,
 
215
 
216
  # Function to update the history list
217
  def update_history_list():
218
+ return [item["image"] for item in generation_history]
 
 
 
219
 
220
  # Function to handle image click in history
221
  def handle_image_click(evt: gr.SelectData):
 
354
  generate_from_json = gr.Button("Generate from JSON")
355
 
356
  # Add history accordion
357
+ with gr.Accordion("Generation History", open=False) as history_accordion:
358
+ history_gallery = gr.Gallery(
359
+ label="History",
360
+ show_label=False,
361
+ elem_id="history_gallery",
362
+ columns=5,
363
+ rows=2,
364
+ height="auto"
365
+ )
366
+ with gr.Row():
367
+ selected_image = gr.Image(label="Selected Image", interactive=False)
368
+ selected_metadata = gr.JSON(label="Selected Metadata", show_label=False)
369
 
370
  gr.Examples(
371
  examples=config.examples,