feat: add refresh button to history tab
Gallery and stats are initialized once at startup and don't auto-refresh. Added a Refresh button so users can manually reload history after processing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -171,7 +171,7 @@ def create_history_tab():
|
|||||||
search_box = gr.Textbox(
|
search_box = gr.Textbox(
|
||||||
label="Search",
|
label="Search",
|
||||||
placeholder="Search by filename...",
|
placeholder="Search by filename...",
|
||||||
scale=2,
|
scale=3,
|
||||||
)
|
)
|
||||||
|
|
||||||
filter_dropdown = gr.Dropdown(
|
filter_dropdown = gr.Dropdown(
|
||||||
@@ -181,6 +181,8 @@ def create_history_tab():
|
|||||||
scale=1,
|
scale=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
refresh_btn = gr.Button("Refresh", variant="secondary", scale=1)
|
||||||
|
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
# Gallery
|
# Gallery
|
||||||
with gr.Column(scale=2):
|
with gr.Column(scale=2):
|
||||||
@@ -253,10 +255,17 @@ def create_history_tab():
|
|||||||
outputs=[gallery, stats_display],
|
outputs=[gallery, stats_display],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
refresh_btn.click(
|
||||||
|
fn=lambda f: (get_history_gallery(f), get_history_stats()),
|
||||||
|
inputs=[filter_dropdown],
|
||||||
|
outputs=[gallery, stats_display],
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"gallery": gallery,
|
"gallery": gallery,
|
||||||
"comparison_slider": comparison_slider,
|
"comparison_slider": comparison_slider,
|
||||||
"item_details": item_details,
|
"item_details": item_details,
|
||||||
"stats_display": stats_display,
|
"stats_display": stats_display,
|
||||||
"filter_dropdown": filter_dropdown,
|
"filter_dropdown": filter_dropdown,
|
||||||
|
"refresh_btn": refresh_btn,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user