Commit
·
6c94821
1
Parent(s):
de9585b
Seems to be working, now to check if timer runs in background for
Browse files
app.py
CHANGED
|
@@ -47,15 +47,20 @@ def get_leaderboard_object(assay: str | None = None):
|
|
| 47 |
current_dataframe = fetch_hf_results()
|
| 48 |
|
| 49 |
with gr.Blocks() as demo:
|
| 50 |
-
timer = gr.Timer(
|
|
|
|
| 51 |
|
| 52 |
def update_current_dataframe():
|
| 53 |
global current_dataframe
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
timer.tick(fn=update_current_dataframe
|
| 58 |
-
timers = [gr.Timer(10) for _ in range(6)] # One timer for each tab
|
| 59 |
|
| 60 |
# TODO: Add Ginkgo logo here on the top right
|
| 61 |
gr.Markdown("""
|
|
@@ -83,25 +88,31 @@ with gr.Blocks() as demo:
|
|
| 83 |
gr.Markdown(f"*{answer}*") # Italics for answers
|
| 84 |
|
| 85 |
# Procedurally make these 5 tabs
|
| 86 |
-
leaderboards = []
|
| 87 |
for i, assay in enumerate(ASSAY_LIST):
|
| 88 |
with gr.TabItem(
|
| 89 |
f"{ASSAY_EMOJIS[assay]} {ASSAY_RENAME[assay]}",
|
| 90 |
elem_id="abdev-benchmark-tab-table",
|
| 91 |
-
):
|
| 92 |
gr.Markdown(f"# {ASSAY_DESCRIPTION[assay]}")
|
| 93 |
lb = get_leaderboard_object(assay=assay)
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
gr.Markdown(
|
| 99 |
"# Antibody Developability Benchmark Leaderboard over all properties"
|
| 100 |
)
|
| 101 |
lb = get_leaderboard_object()
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
| 105 |
|
| 106 |
with gr.TabItem("✉️ Submit", elem_id="boundary-benchmark-tab-table"):
|
| 107 |
gr.Markdown(
|
|
|
|
| 47 |
current_dataframe = fetch_hf_results()
|
| 48 |
|
| 49 |
with gr.Blocks() as demo:
|
| 50 |
+
timer = gr.Timer(3) # Run every 3 seconds when page is focused
|
| 51 |
+
data_version = gr.State(value=0) # Track data changes
|
| 52 |
|
| 53 |
def update_current_dataframe():
|
| 54 |
global current_dataframe
|
| 55 |
+
new_dataframe = fetch_hf_results()
|
| 56 |
+
|
| 57 |
+
# Check if data has actually changed
|
| 58 |
+
if not current_dataframe.equals(new_dataframe):
|
| 59 |
+
current_dataframe = new_dataframe
|
| 60 |
+
return data_version.value + 1 # Increment version to trigger updates
|
| 61 |
+
return data_version.value
|
| 62 |
|
| 63 |
+
timer.tick(fn=update_current_dataframe, outputs=data_version)
|
|
|
|
| 64 |
|
| 65 |
# TODO: Add Ginkgo logo here on the top right
|
| 66 |
gr.Markdown("""
|
|
|
|
| 88 |
gr.Markdown(f"*{answer}*") # Italics for answers
|
| 89 |
|
| 90 |
# Procedurally make these 5 tabs
|
|
|
|
| 91 |
for i, assay in enumerate(ASSAY_LIST):
|
| 92 |
with gr.TabItem(
|
| 93 |
f"{ASSAY_EMOJIS[assay]} {ASSAY_RENAME[assay]}",
|
| 94 |
elem_id="abdev-benchmark-tab-table",
|
| 95 |
+
) as tab_item:
|
| 96 |
gr.Markdown(f"# {ASSAY_DESCRIPTION[assay]}")
|
| 97 |
lb = get_leaderboard_object(assay=assay)
|
| 98 |
+
|
| 99 |
+
def refresh_leaderboard(assay=assay):
|
| 100 |
+
return format_leaderboard_table(df_results=current_dataframe, assay=assay)
|
| 101 |
+
|
| 102 |
+
# Refresh when data version changes
|
| 103 |
+
data_version.change(fn=refresh_leaderboard, outputs=lb)
|
| 104 |
+
|
| 105 |
+
with gr.TabItem("🚀 Overall", elem_id="abdev-benchmark-tab-table") as overall_tab:
|
| 106 |
gr.Markdown(
|
| 107 |
"# Antibody Developability Benchmark Leaderboard over all properties"
|
| 108 |
)
|
| 109 |
lb = get_leaderboard_object()
|
| 110 |
+
|
| 111 |
+
def refresh_overall_leaderboard():
|
| 112 |
+
return format_leaderboard_table(df_results=current_dataframe)
|
| 113 |
+
|
| 114 |
+
# Refresh when data version changes
|
| 115 |
+
data_version.change(fn=refresh_overall_leaderboard, outputs=lb)
|
| 116 |
|
| 117 |
with gr.TabItem("✉️ Submit", elem_id="boundary-benchmark-tab-table"):
|
| 118 |
gr.Markdown(
|