Commit
•
f12aa56
1
Parent(s):
54e105e
Add checkbox in Configs to show only differences
Browse files- app.py +9 -2
- src/results.py +7 -3
app.py
CHANGED
@@ -80,6 +80,7 @@ with gr.Blocks(fill_height=True, fill_width=True) as demo:
|
|
80 |
lines=3,
|
81 |
visible=False,
|
82 |
)
|
|
|
83 |
configs = gr.HTML()
|
84 |
with gr.Tab("Details"):
|
85 |
details_task = gr.Radio(
|
@@ -141,9 +142,15 @@ with gr.Blocks(fill_height=True, fill_width=True) as demo:
|
|
141 |
)
|
142 |
# Display results
|
143 |
gr.on(
|
144 |
-
triggers=[
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
fn=display_results,
|
146 |
-
inputs=[results_task, hide_errors, dataframe_1, dataframe_2],
|
147 |
outputs=[results, configs],
|
148 |
)
|
149 |
gr.on(
|
|
|
80 |
lines=3,
|
81 |
visible=False,
|
82 |
)
|
83 |
+
show_only_differences = gr.Checkbox(label="Show Only Differences", value=False, info="Options")
|
84 |
configs = gr.HTML()
|
85 |
with gr.Tab("Details"):
|
86 |
details_task = gr.Radio(
|
|
|
142 |
)
|
143 |
# Display results
|
144 |
gr.on(
|
145 |
+
triggers=[
|
146 |
+
dataframe_1.change,
|
147 |
+
dataframe_2.change,
|
148 |
+
results_task.change,
|
149 |
+
hide_errors.change,
|
150 |
+
show_only_differences.change,
|
151 |
+
],
|
152 |
fn=display_results,
|
153 |
+
inputs=[results_task, hide_errors, show_only_differences, dataframe_1, dataframe_2],
|
154 |
outputs=[results, configs],
|
155 |
)
|
156 |
gr.on(
|
src/results.py
CHANGED
@@ -51,7 +51,7 @@ async def load_results_dataframes(*model_ids, result_paths_per_model=None):
|
|
51 |
return result
|
52 |
|
53 |
|
54 |
-
def display_results(task, hide_errors, *dfs):
|
55 |
dfs = [df.set_index("index") for df in dfs if "index" in df.columns]
|
56 |
if not dfs:
|
57 |
return None, None
|
@@ -59,11 +59,13 @@ def display_results(task, hide_errors, *dfs):
|
|
59 |
df = df.T.rename_axis(columns=None)
|
60 |
return (
|
61 |
display_tab("results", df, task, hide_errors=hide_errors),
|
62 |
-
display_tab("configs", df, task),
|
63 |
)
|
64 |
|
65 |
|
66 |
-
def display_tab(tab, df, task, hide_errors=True):
|
|
|
|
|
67 |
df = df.style.format(escape="html", na_rep="")
|
68 |
df.hide(
|
69 |
[
|
@@ -80,6 +82,8 @@ def display_tab(tab, df, task, hide_errors=True):
|
|
80 |
)
|
81 |
# Hide errors
|
82 |
or (hide_errors and row.endswith("_stderr,none"))
|
|
|
|
|
83 |
)
|
84 |
],
|
85 |
axis="index",
|
|
|
51 |
return result
|
52 |
|
53 |
|
54 |
+
def display_results(task, hide_errors, show_only_differences, *dfs):
|
55 |
dfs = [df.set_index("index") for df in dfs if "index" in df.columns]
|
56 |
if not dfs:
|
57 |
return None, None
|
|
|
59 |
df = df.T.rename_axis(columns=None)
|
60 |
return (
|
61 |
display_tab("results", df, task, hide_errors=hide_errors),
|
62 |
+
display_tab("configs", df, task, show_only_differences=show_only_differences),
|
63 |
)
|
64 |
|
65 |
|
66 |
+
def display_tab(tab, df, task, hide_errors=True, show_only_differences=False):
|
67 |
+
if show_only_differences:
|
68 |
+
any_difference = df.ne(df.iloc[:, 0], axis=0).any(axis=1)
|
69 |
df = df.style.format(escape="html", na_rep="")
|
70 |
df.hide(
|
71 |
[
|
|
|
82 |
)
|
83 |
# Hide errors
|
84 |
or (hide_errors and row.endswith("_stderr,none"))
|
85 |
+
# Hide non-different rows
|
86 |
+
or (show_only_differences and not any_difference[row])
|
87 |
)
|
88 |
],
|
89 |
axis="index",
|