Spaces:
Paused
Paused
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -399,8 +399,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
399 |
|
400 |
performance_plot = gr.Plot(label="Performance Metrics")
|
401 |
|
402 |
-
with gr.Accordion("Recent Generations (last
|
403 |
-
recent_gallery = gr.Gallery(
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
|
405 |
def update_recent_gallery(prompt, results):
|
406 |
recent_generations.append({
|
@@ -409,13 +415,20 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
409 |
"hidream-dev": results["hidream-dev"],
|
410 |
"hidream-full": results["hidream-full"],
|
411 |
})
|
412 |
-
if len(recent_generations) >
|
413 |
recent_generations.pop(0)
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
419 |
|
420 |
# Add custom CSS for the big status box
|
421 |
css = """
|
|
|
399 |
|
400 |
performance_plot = gr.Plot(label="Performance Metrics")
|
401 |
|
402 |
+
with gr.Accordion("Recent Generations (last 8)", open=False):
|
403 |
+
recent_gallery = gr.Gallery(
|
404 |
+
label="Recent Generations",
|
405 |
+
show_label=False,
|
406 |
+
elem_id="recent-gallery",
|
407 |
+
columns=4,
|
408 |
+
height="auto",
|
409 |
+
).style(grid=2)
|
410 |
|
411 |
def update_recent_gallery(prompt, results):
|
412 |
recent_generations.append({
|
|
|
415 |
"hidream-dev": results["hidream-dev"],
|
416 |
"hidream-full": results["hidream-full"],
|
417 |
})
|
418 |
+
if len(recent_generations) > 8:
|
419 |
recent_generations.pop(0)
|
420 |
+
|
421 |
+
# Flatten the images from each generation
|
422 |
+
all_images = []
|
423 |
+
for gen in reversed(recent_generations): # Show newest first
|
424 |
+
all_images.extend([
|
425 |
+
gen["flux-dev"],
|
426 |
+
gen["hidream-dev"],
|
427 |
+
gen["hidream-full"]
|
428 |
+
])
|
429 |
+
|
430 |
+
# Update the Gradio gallery with the new list
|
431 |
+
return recent_gallery.update(value=all_images)
|
432 |
|
433 |
# Add custom CSS for the big status box
|
434 |
css = """
|