Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Add custom url for second tab
Browse files
app.py
CHANGED
@@ -398,12 +398,21 @@ def search_table(df, query):
|
|
398 |
filtered_df = df[df["model_name_for_query"].str.contains(query, case=False)]
|
399 |
return filtered_df
|
400 |
|
|
|
401 |
def change_tab(query_param):
|
402 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
403 |
return gr.Tabs.update(selected=1)
|
404 |
else:
|
405 |
return gr.Tabs.update(selected=0)
|
406 |
|
|
|
407 |
custom_css = """
|
408 |
#changelog-text {
|
409 |
font-size: 16px !important;
|
@@ -486,7 +495,7 @@ with demo:
|
|
486 |
gr.HTML(TITLE)
|
487 |
with gr.Row():
|
488 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
489 |
-
|
490 |
with gr.Row():
|
491 |
with gr.Column():
|
492 |
with gr.Accordion("π Citation", open=False):
|
@@ -644,8 +653,6 @@ with demo:
|
|
644 |
elem_id="models-to-add-text",
|
645 |
)
|
646 |
|
647 |
-
|
648 |
-
|
649 |
dummy = gr.Textbox(visible=False)
|
650 |
demo.load(
|
651 |
change_tab,
|
@@ -653,22 +660,22 @@ with demo:
|
|
653 |
tabs,
|
654 |
_js=get_window_url_params,
|
655 |
)
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
|
673 |
scheduler = BackgroundScheduler()
|
674 |
scheduler.add_job(restart_space, "interval", seconds=3600)
|
|
|
398 |
filtered_df = df[df["model_name_for_query"].str.contains(query, case=False)]
|
399 |
return filtered_df
|
400 |
|
401 |
+
|
402 |
def change_tab(query_param):
|
403 |
+
query_param = query_param.replace("'", '"')
|
404 |
+
query_param = json.loads(query_param)
|
405 |
+
|
406 |
+
if (
|
407 |
+
isinstance(query_param, dict)
|
408 |
+
and "tab" in query_param
|
409 |
+
and query_param["tab"] == "evaluation"
|
410 |
+
):
|
411 |
return gr.Tabs.update(selected=1)
|
412 |
else:
|
413 |
return gr.Tabs.update(selected=0)
|
414 |
|
415 |
+
|
416 |
custom_css = """
|
417 |
#changelog-text {
|
418 |
font-size: 16px !important;
|
|
|
495 |
gr.HTML(TITLE)
|
496 |
with gr.Row():
|
497 |
gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
|
498 |
+
|
499 |
with gr.Row():
|
500 |
with gr.Column():
|
501 |
with gr.Accordion("π Citation", open=False):
|
|
|
653 |
elem_id="models-to-add-text",
|
654 |
)
|
655 |
|
|
|
|
|
656 |
dummy = gr.Textbox(visible=False)
|
657 |
demo.load(
|
658 |
change_tab,
|
|
|
660 |
tabs,
|
661 |
_js=get_window_url_params,
|
662 |
)
|
663 |
+
# with gr.Box():
|
664 |
+
# visualization_title = gr.HTML(VISUALIZATION_TITLE)
|
665 |
+
# with gr.Row():
|
666 |
+
# with gr.Column():
|
667 |
+
# gr.Markdown(f"#### Figure 1: {PLOT_1_TITLE}")
|
668 |
+
# plot_1 = gr.Plot(plot_1, show_label=False)
|
669 |
+
# with gr.Column():
|
670 |
+
# gr.Markdown(f"#### Figure 2: {PLOT_2_TITLE}")
|
671 |
+
# plot_2 = gr.Plot(plot_2, show_label=False)
|
672 |
+
# with gr.Row():
|
673 |
+
# with gr.Column():
|
674 |
+
# gr.Markdown(f"#### Figure 3: {PLOT_3_TITLE}")
|
675 |
+
# plot_3 = gr.Plot(plot_3, show_label=False)
|
676 |
+
# with gr.Column():
|
677 |
+
# gr.Markdown(f"#### Figure 4: {PLOT_4_TITLE}")
|
678 |
+
# plot_4 = gr.Plot(plot_4, show_label=False)
|
679 |
|
680 |
scheduler = BackgroundScheduler()
|
681 |
scheduler.add_job(restart_space, "interval", seconds=3600)
|
utils.py
CHANGED
@@ -140,10 +140,11 @@ def get_eval_results_dicts(is_public=True) -> List[Dict]:
|
|
140 |
|
141 |
return [e.to_dict() for e in eval_results]
|
142 |
|
|
|
143 |
get_window_url_params = """
|
144 |
function(url_params) {
|
145 |
const params = new URLSearchParams(window.location.search);
|
146 |
url_params = Object.fromEntries(params);
|
147 |
return url_params;
|
148 |
-
|
149 |
"""
|
|
|
140 |
|
141 |
return [e.to_dict() for e in eval_results]
|
142 |
|
143 |
+
|
144 |
get_window_url_params = """
|
145 |
function(url_params) {
|
146 |
const params = new URLSearchParams(window.location.search);
|
147 |
url_params = Object.fromEntries(params);
|
148 |
return url_params;
|
149 |
+
}
|
150 |
"""
|