Fix: force refresh for embedding and hypernetwork tables initialization

This commit is contained in:
Thawtz
2025-08-18 05:42:38 -05:00
parent 3eca178f80
commit 117e52a7b5
2 changed files with 10 additions and 3 deletions

View File

@@ -94,8 +94,13 @@ class DatabaseManager:
"message": "No valid table types to process"
}) + "\n"
return
if refresh:
for page in pages.values():
page.refresh()
total_items = sum(len(list(page.list_items()) or []) for page in pages.values())
pbar = tqdm(total=total_items, unit='item',
bar_format='{l_bar}{bar}| {n_fmt}/{total_fmt} [{percentage:3.0f}%]')

View File

@@ -78,9 +78,10 @@ def initialize_tables():
else:
logger.debug("All tables already exist in database")
initialize_tables()
def on_ui_tabs():
# Make sure tables are initialized when UI loads
initialize_tables()
with gr.Blocks(analytics_enabled=False) as anapnoe_sd_uiux_db:
refresh_button = gr.Button("Refresh Database", elem_id="refresh_database")
refresh_button.click(fn=initialize_tables, inputs=[], outputs=[])
@@ -88,3 +89,4 @@ def on_ui_tabs():
return (anapnoe_sd_uiux_db, 'Init DB', 'anapnoe_sd_uiux_db'),
script_callbacks.on_ui_tabs(on_ui_tabs)