Molbap HF Staff commited on
Commit
5ff759b
Β·
verified Β·
1 Parent(s): a2b0a06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -78,6 +78,7 @@ def run_timeline(repo_url: str, threshold: float, multimodal: bool, sim_method:
78
  CUSTOM_CSS = """
79
  #graph_html iframe, #timeline_html iframe {height:85vh !important; width:100% !important; border:none;}
80
  """
 
81
 
82
  with gr.Blocks(css=CUSTOM_CSS) as demo:
83
  gr.Markdown("## πŸ” Modular-candidate explorer for πŸ€— Transformers")
@@ -126,10 +127,12 @@ with gr.Blocks(css=CUSTOM_CSS) as demo:
126
  )
127
 
128
  def _select_tab_on_load(req: gr.Request):
129
- tab = (req.query_params or {}).get("tab")
130
- if tab in {"timeline", "loc", "graph"}:
131
- return gr.update(selected=tab)
132
- return gr.update()
 
 
133
 
134
  demo.load(_select_tab_on_load, outputs=tabs)
135
 
 
78
  CUSTOM_CSS = """
79
  #graph_html iframe, #timeline_html iframe {height:85vh !important; width:100% !important; border:none;}
80
  """
81
+ TAB_INDEX = {"timeline": 0, "loc": 1, "graph": 2}
82
 
83
  with gr.Blocks(css=CUSTOM_CSS) as demo:
84
  gr.Markdown("## πŸ” Modular-candidate explorer for πŸ€— Transformers")
 
127
  )
128
 
129
  def _select_tab_on_load(req: gr.Request):
130
+ qp = req.query_params or {}
131
+ key = (qp.get("tab") or "").lower()
132
+ idx = TAB_INDEX.get(key)
133
+ if idx is not None:
134
+ return gr.Tabs.update(selected=idx)
135
+ return gr.Tabs.update()
136
 
137
  demo.load(_select_tab_on_load, outputs=tabs)
138