unijoh commited on
Commit
6f82a6b
·
verified ·
1 Parent(s): 1e18e80

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -746,17 +746,21 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
746
  overview_md = gr.Markdown(build_overview("fo"))
747
 
748
  def show_loading(lang_current):
749
- """Show the results table immediately so Gradio can display its built-in loading indicator.
750
 
751
- Also disables the button + changes its label while the model runs.
 
 
752
  """
753
  lang_current = "fo" if lang_current == "fo" else "en"
754
  cols_main = [UI[lang_current]["w"], UI[lang_current]["t"], UI[lang_current]["s"]]
755
  shell = _make_html_table(cols_main, [])
756
  return (
757
  gr.update(value=shell, visible=True),
758
- gr.update(visible=False), # hide main download while processing
759
- gr.update(visible=False), # hide expanded download while processing
 
 
760
  gr.update(value="Markar... / Tagging...", interactive=False),
761
  )
762
 
@@ -818,7 +822,7 @@ with gr.Blocks(css=CSS, title="Marka") as demo:
818
  _evt = btn.click(
819
  show_loading,
820
  inputs=[lang_state],
821
- outputs=[out_df, btn_dl_main, btn_dl_exp, btn],
822
  queue=False,
823
  )
824
 
 
746
  overview_md = gr.Markdown(build_overview("fo"))
747
 
748
  def show_loading(lang_current):
749
+ """Instant feedback on click.
750
 
751
+ - Shows the (empty) results table immediately so Gradio can display its built-in loading overlay.
752
+ - Hides/collapses the Expanded tags section while processing (avoids duplicate loading skeletons).
753
+ - Disables the button + changes its label while the model runs.
754
  """
755
  lang_current = "fo" if lang_current == "fo" else "en"
756
  cols_main = [UI[lang_current]["w"], UI[lang_current]["t"], UI[lang_current]["s"]]
757
  shell = _make_html_table(cols_main, [])
758
  return (
759
  gr.update(value=shell, visible=True),
760
+ gr.update(visible=False), # hide main download while processing
761
+ gr.update(visible=False), # hide expanded download while processing
762
+ gr.update(visible=False), # hide + collapse expanded section while processing
763
+ gr.update(value=""), # clear expanded content (prevents flashing stale content)
764
  gr.update(value="Markar... / Tagging...", interactive=False),
765
  )
766
 
 
822
  _evt = btn.click(
823
  show_loading,
824
  inputs=[lang_state],
825
+ outputs=[out_df, btn_dl_main, btn_dl_exp, expanded_acc, out_mean_df, btn],
826
  queue=False,
827
  )
828