Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -99,39 +99,58 @@ with block:
|
|
| 99 |
# Dropdown for benchmark type
|
| 100 |
benchmark_types = TASK_INFO + ['flexible']
|
| 101 |
benchmark_type_selector = gr.Dropdown(choices=benchmark_types, label="Select Benchmark Type for Visualization", value="flexible")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
-
#
|
| 104 |
-
x_metric_selector = gr.Dropdown(choices=[], label="Select X-axis Metric")
|
| 105 |
-
y_metric_selector = gr.Dropdown(choices=[], label="Select Y-axis Metric")
|
| 106 |
method_selector = gr.CheckboxGroup(choices=method_names, label="Select methods to visualize", interactive=True, value=method_names)
|
| 107 |
|
| 108 |
# Button to draw the plot for the selected benchmark
|
| 109 |
plot_button = gr.Button("Plot")
|
| 110 |
plot_output = gr.Image(label="Plot")
|
| 111 |
-
|
| 112 |
# Update metric selectors when benchmark type is chosen
|
| 113 |
def update_metric_choices(benchmark_type):
|
| 114 |
-
if benchmark_type == 'flexible':
|
| 115 |
-
# Show
|
| 116 |
-
metric_names =
|
| 117 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
elif benchmark_type in benchmark_specific_metrics:
|
|
|
|
| 119 |
metrics = benchmark_specific_metrics[benchmark_type]
|
| 120 |
-
return
|
| 121 |
-
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
benchmark_type_selector.change(
|
| 124 |
-
update_metric_choices,
|
| 125 |
-
inputs=[benchmark_type_selector],
|
| 126 |
-
outputs=[x_metric_selector, y_metric_selector]
|
| 127 |
)
|
| 128 |
-
|
| 129 |
# Generate the plot based on user input
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
plot_button.click(
|
| 131 |
-
benchmark_plot,
|
| 132 |
-
inputs=[benchmark_type_selector, method_selector, x_metric_selector, y_metric_selector],
|
| 133 |
outputs=plot_output
|
| 134 |
-
|
| 135 |
|
| 136 |
with gr.TabItem("📝 About", elem_id="probe-benchmark-tab-table", id=2):
|
| 137 |
with gr.Row():
|
|
@@ -170,18 +189,13 @@ with block:
|
|
| 170 |
interactive=True,
|
| 171 |
)
|
| 172 |
|
| 173 |
-
function_prediction_dataset = gr.Radio(
|
| 174 |
-
choices=function_prediction_dataset_options,
|
| 175 |
-
label="Select Function Prediction Dataset",
|
| 176 |
-
interactive=True,
|
| 177 |
-
)
|
| 178 |
-
|
| 179 |
family_prediction_dataset = gr.CheckboxGroup(
|
| 180 |
choices=family_prediction_dataset_options,
|
| 181 |
label="Select Family Prediction Dataset",
|
| 182 |
interactive=True,
|
| 183 |
)
|
| 184 |
|
|
|
|
| 185 |
with gr.Column():
|
| 186 |
human_file = gr.components.File(label="Click to Upload the representation file (csv) for Human dataset", file_count="single", type='filepath')
|
| 187 |
skempi_file = gr.components.File(label="Click to Upload the representation file (csv) for SKEMPI dataset", file_count="single", type='filepath')
|
|
|
|
| 99 |
# Dropdown for benchmark type
|
| 100 |
benchmark_types = TASK_INFO + ['flexible']
|
| 101 |
benchmark_type_selector = gr.Dropdown(choices=benchmark_types, label="Select Benchmark Type for Visualization", value="flexible")
|
| 102 |
+
|
| 103 |
+
x_metric_selector = gr.Dropdown(choices=[], label="Select X-axis Metric", visible=False)
|
| 104 |
+
y_metric_selector = gr.Dropdown(choices=[], label="Select Y-axis Metric", visible=False)
|
| 105 |
+
single_metric_selector = gr.Dropdown(choices=[], label="Select Metric", visible=False)
|
| 106 |
|
| 107 |
+
# CheckboxGroup for methods
|
|
|
|
|
|
|
| 108 |
method_selector = gr.CheckboxGroup(choices=method_names, label="Select methods to visualize", interactive=True, value=method_names)
|
| 109 |
|
| 110 |
# Button to draw the plot for the selected benchmark
|
| 111 |
plot_button = gr.Button("Plot")
|
| 112 |
plot_output = gr.Image(label="Plot")
|
| 113 |
+
|
| 114 |
# Update metric selectors when benchmark type is chosen
|
| 115 |
def update_metric_choices(benchmark_type):
|
| 116 |
+
if benchmark_type == 'flexible' or benchmark_type == 'similarity':
|
| 117 |
+
# Show x and y metric selectors for similarity and flexible
|
| 118 |
+
metric_names = benchmark_specific_metrics.get(benchmark_type, [])
|
| 119 |
+
return (
|
| 120 |
+
gr.update(choices=metric_names, value=metric_names[0], visible=True),
|
| 121 |
+
gr.update(choices=metric_names, value=metric_names[1], visible=True),
|
| 122 |
+
gr.update(visible=False) # Hide single metric selector
|
| 123 |
+
)
|
| 124 |
elif benchmark_type in benchmark_specific_metrics:
|
| 125 |
+
# Show single metric selector for other benchmark types
|
| 126 |
metrics = benchmark_specific_metrics[benchmark_type]
|
| 127 |
+
return (
|
| 128 |
+
gr.update(visible=False), # Hide x-axis metric selector
|
| 129 |
+
gr.update(visible=False), # Hide y-axis metric selector
|
| 130 |
+
gr.update(choices=metrics, value=metrics[0], visible=True)
|
| 131 |
+
)
|
| 132 |
+
return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 133 |
+
|
| 134 |
+
# Dropdown for benchmark type
|
| 135 |
+
benchmark_type_selector = gr.Dropdown(choices=list(benchmark_specific_metrics.keys()), label="Select Benchmark Type")
|
| 136 |
+
|
| 137 |
+
# Update selectors when benchmark type changes
|
| 138 |
benchmark_type_selector.change(
|
| 139 |
+
update_metric_choices,
|
| 140 |
+
inputs=[benchmark_type_selector],
|
| 141 |
+
outputs=[x_metric_selector, y_metric_selector, single_metric_selector]
|
| 142 |
)
|
| 143 |
+
|
| 144 |
# Generate the plot based on user input
|
| 145 |
+
def benchmark_plot(benchmark_type, method_names, x_metric, y_metric, single_metric):
|
| 146 |
+
# Implement plot generation logic based on selected benchmark type and metrics
|
| 147 |
+
pass
|
| 148 |
+
|
| 149 |
plot_button.click(
|
| 150 |
+
benchmark_plot,
|
| 151 |
+
inputs=[benchmark_type_selector, method_selector, x_metric_selector, y_metric_selector, single_metric_selector],
|
| 152 |
outputs=plot_output
|
| 153 |
+
)
|
| 154 |
|
| 155 |
with gr.TabItem("📝 About", elem_id="probe-benchmark-tab-table", id=2):
|
| 156 |
with gr.Row():
|
|
|
|
| 189 |
interactive=True,
|
| 190 |
)
|
| 191 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 192 |
family_prediction_dataset = gr.CheckboxGroup(
|
| 193 |
choices=family_prediction_dataset_options,
|
| 194 |
label="Select Family Prediction Dataset",
|
| 195 |
interactive=True,
|
| 196 |
)
|
| 197 |
|
| 198 |
+
function_prediction_dataset = "All_Data_Sets"
|
| 199 |
with gr.Column():
|
| 200 |
human_file = gr.components.File(label="Click to Upload the representation file (csv) for Human dataset", file_count="single", type='filepath')
|
| 201 |
skempi_file = gr.components.File(label="Click to Upload the representation file (csv) for SKEMPI dataset", file_count="single", type='filepath')
|