Molbap HF Staff commited on
Commit
a83bf3e
·
verified ·
1 Parent(s): 5163a1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -26
app.py CHANGED
@@ -126,31 +126,31 @@ with gr.Blocks(css=CUSTOM_CSS) as demo:
126
  )
127
  embed_html = gr.HTML(visible=False)
128
 
129
- def _on_load(req: gr.Request):
130
- qp = req.query_params or {}
131
- tab_key = (qp.get("tab") or "").lower()
132
- embed = (qp.get("embed") == "1")
133
-
134
- tab_sel = TAB_INDEX.get(tab_key, 0)
135
-
136
- if embed:
137
- if tab_key == "graph":
138
- html, _ = run_graph(HF_MAIN_REPO, 0.7, False, "jaccard")
139
- elif tab_key == "timeline":
140
- html, _ = run_timeline(HF_MAIN_REPO, 0.7, False, "jaccard")
141
- else: # "loc" or anything else
142
- html = run_loc("jaccard", False)
143
-
 
 
 
 
 
 
144
  return (
145
- gr.update(visible=False), # header
146
- gr.update(visible=False), # tabs
147
- gr.update(value=html, visible=True), # embed_html
148
  )
149
-
150
- return (
151
- gr.update(visible=True), # header
152
- gr.update(visible=True, selected=tab_sel), # tabs
153
- gr.update(visible=False), # embed_html
154
- )
155
-
156
- demo.load(_on_load, outputs=[header, tabs, embed_html])
 
126
  )
127
  embed_html = gr.HTML(visible=False)
128
 
129
+ def _on_load(req: gr.Request):
130
+ qp = req.query_params or {}
131
+ tab_key = (qp.get("tab") or "").lower()
132
+ embed = (qp.get("embed") == "1")
133
+
134
+ tab_sel = TAB_INDEX.get(tab_key, 0)
135
+
136
+ if embed:
137
+ if tab_key == "graph":
138
+ html, _ = run_graph(HF_MAIN_REPO, 0.7, False, "jaccard")
139
+ elif tab_key == "timeline":
140
+ html, _ = run_timeline(HF_MAIN_REPO, 0.7, False, "jaccard")
141
+ else: # "loc" or anything else
142
+ html = run_loc("jaccard", False)
143
+
144
+ return (
145
+ gr.update(visible=False), # header
146
+ gr.update(visible=False), # tabs
147
+ gr.update(value=html, visible=True), # embed_html
148
+ )
149
+
150
  return (
151
+ gr.update(visible=True), # header
152
+ gr.update(visible=True, selected=tab_sel), # tabs
153
+ gr.update(visible=False), # embed_html
154
  )
155
+
156
+ demo.load(_on_load, outputs=[header, tabs, embed_html])