Spaces:
Sleeping
Sleeping
Commit
•
8f7c83f
1
Parent(s):
651545d
Display loading message
Browse files- app.py +10 -3
- src/details.py +4 -0
- src/results.py +4 -0
app.py
CHANGED
@@ -4,11 +4,11 @@ import gradio as gr
|
|
4 |
|
5 |
import src.constants as constants
|
6 |
from src.details import update_subtasks_component, update_load_details_component, load_details_dataframes, \
|
7 |
-
display_details, update_sample_idx_component, clear_details, update_task_description_component
|
|
|
8 |
from src.results import update_load_results_component, \
|
9 |
load_results_dataframes, display_results, update_tasks_component, clear_results, \
|
10 |
-
sort_result_paths_per_model, fetch_result_paths
|
11 |
-
|
12 |
|
13 |
# if __name__ == "__main__":
|
14 |
result_paths_per_model = sort_result_paths_per_model(fetch_result_paths())
|
@@ -99,6 +99,9 @@ with gr.Blocks(fill_height=True, fill_width=True) as demo:
|
|
99 |
)
|
100 |
gr.on(
|
101 |
triggers=[load_results_btn.click, load_configs_btn.click],
|
|
|
|
|
|
|
102 |
fn=load_results_dataframes,
|
103 |
inputs=[model_id_1, model_id_2],
|
104 |
outputs=[dataframe_1, dataframe_2],
|
@@ -132,6 +135,7 @@ with gr.Blocks(fill_height=True, fill_width=True) as demo:
|
|
132 |
outputs=[model_id_1, model_id_2, dataframe_1, dataframe_2, load_results_btn, load_configs_btn, results_task, configs_task],
|
133 |
)
|
134 |
|
|
|
135 |
details_task.change(
|
136 |
fn=update_task_description_component,
|
137 |
inputs=details_task,
|
@@ -148,6 +152,9 @@ with gr.Blocks(fill_height=True, fill_width=True) as demo:
|
|
148 |
outputs=load_details_btn,
|
149 |
)
|
150 |
load_details_btn.click(
|
|
|
|
|
|
|
151 |
fn=load_details_dataframes,
|
152 |
inputs=[subtask, model_id_1, model_id_2],
|
153 |
outputs=[details_dataframe_1, details_dataframe_2],
|
|
|
4 |
|
5 |
import src.constants as constants
|
6 |
from src.details import update_subtasks_component, update_load_details_component, load_details_dataframes, \
|
7 |
+
display_details, update_sample_idx_component, clear_details, update_task_description_component, \
|
8 |
+
display_loading_message_for_details
|
9 |
from src.results import update_load_results_component, \
|
10 |
load_results_dataframes, display_results, update_tasks_component, clear_results, \
|
11 |
+
sort_result_paths_per_model, fetch_result_paths, display_loading_message_for_results
|
|
|
12 |
|
13 |
# if __name__ == "__main__":
|
14 |
result_paths_per_model = sort_result_paths_per_model(fetch_result_paths())
|
|
|
99 |
)
|
100 |
gr.on(
|
101 |
triggers=[load_results_btn.click, load_configs_btn.click],
|
102 |
+
fn=display_loading_message_for_results,
|
103 |
+
outputs=[results, configs],
|
104 |
+
).then(
|
105 |
fn=load_results_dataframes,
|
106 |
inputs=[model_id_1, model_id_2],
|
107 |
outputs=[dataframe_1, dataframe_2],
|
|
|
135 |
outputs=[model_id_1, model_id_2, dataframe_1, dataframe_2, load_results_btn, load_configs_btn, results_task, configs_task],
|
136 |
)
|
137 |
|
138 |
+
# DETAILS:
|
139 |
details_task.change(
|
140 |
fn=update_task_description_component,
|
141 |
inputs=details_task,
|
|
|
152 |
outputs=load_details_btn,
|
153 |
)
|
154 |
load_details_btn.click(
|
155 |
+
fn=display_loading_message_for_details,
|
156 |
+
outputs=details,
|
157 |
+
).then(
|
158 |
fn=load_details_dataframes,
|
159 |
inputs=[subtask, model_id_1, model_id_2],
|
160 |
outputs=[details_dataframe_1, details_dataframe_2],
|
src/details.py
CHANGED
@@ -96,3 +96,7 @@ def clear_details():
|
|
96 |
gr.Button("Load Details", interactive=False),
|
97 |
gr.Number(label="Sample Index", info="Index of the sample to be displayed", value=0, minimum=0,visible=False),
|
98 |
)
|
|
|
|
|
|
|
|
|
|
96 |
gr.Button("Load Details", interactive=False),
|
97 |
gr.Number(label="Sample Index", info="Index of the sample to be displayed", value=0, minimum=0,visible=False),
|
98 |
)
|
99 |
+
|
100 |
+
|
101 |
+
def display_loading_message_for_details():
|
102 |
+
return "<h3 style='text-align: center;'>Loading...</h3>"
|
src/results.py
CHANGED
@@ -113,3 +113,7 @@ def highlight_min_max(s):
|
|
113 |
return np.where(s == np.nanmax(s.values), "background-color:green", "background-color:#D81B60")
|
114 |
else:
|
115 |
return [""] * len(s)
|
|
|
|
|
|
|
|
|
|
113 |
return np.where(s == np.nanmax(s.values), "background-color:green", "background-color:#D81B60")
|
114 |
else:
|
115 |
return [""] * len(s)
|
116 |
+
|
117 |
+
|
118 |
+
def display_loading_message_for_results():
|
119 |
+
return ("<h3 style='text-align: center;'>Loading...</h3>", ) * 2
|