Spaces:
Running
Running
Takashi Itoh
commited on
Commit
•
335da0b
1
Parent(s):
96fd466
No meed to return state on display_eval
Browse files
app.py
CHANGED
@@ -243,27 +243,30 @@ def display_eval(selected_models, dataset, task_type, downstream, fusion_type, s
|
|
243 |
|
244 |
try:
|
245 |
if not selected_models:
|
246 |
-
return "Please select at least one enabled model."
|
247 |
|
248 |
if len(selected_models) > 1:
|
249 |
if task_type == "Classification":
|
250 |
if downstream_model == "Default Settings":
|
251 |
downstream_model = "DefaultClassifier"
|
252 |
params = None
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
|
|
|
|
257 |
|
258 |
elif task_type == "Regression":
|
259 |
if downstream_model == "Default Settings":
|
260 |
downstream_model = "DefaultRegressor"
|
261 |
params = None
|
262 |
|
263 |
-
result, state["RMSE"], state["y_batch_test"], state["y_prob"], state["x_batch"], state["y_batch"] =
|
264 |
-
|
265 |
-
|
266 |
-
|
|
|
267 |
|
268 |
else:
|
269 |
if task_type == "Classification":
|
@@ -271,26 +274,28 @@ def display_eval(selected_models, dataset, task_type, downstream, fusion_type, s
|
|
271 |
downstream_model = "DefaultClassifier"
|
272 |
params = None
|
273 |
|
274 |
-
result, state["roc_auc"], state["fpr"], state["tpr"], state["x_batch"], state["y_batch"] =
|
275 |
-
|
276 |
-
|
277 |
-
|
|
|
278 |
|
279 |
elif task_type == "Regression":
|
280 |
if downstream_model == "Default Settings":
|
281 |
downstream_model = "DefaultRegressor"
|
282 |
params = None
|
283 |
|
284 |
-
result, state["RMSE"], state["y_batch_test"], state["y_prob"], state["x_batch"], state["y_batch"] =
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
288 |
|
289 |
if result == None:
|
290 |
result = "Data & Model Setting is incorrect"
|
291 |
except Exception as e:
|
292 |
-
return f"An error occurred: {e}"
|
293 |
-
return f"{result}"
|
294 |
|
295 |
|
296 |
# Function to handle plot display
|
@@ -604,7 +609,7 @@ with gr.Blocks() as demo:
|
|
604 |
|
605 |
eval_button.click(display_eval,
|
606 |
inputs=[model_checkbox, selected_columns_message, task_radiobutton, output, fusion_radiobutton, state],
|
607 |
-
outputs=
|
608 |
|
609 |
plot_radio.change(display_plot, inputs=[plot_radio, state], outputs=plot_output)
|
610 |
|
|
|
243 |
|
244 |
try:
|
245 |
if not selected_models:
|
246 |
+
return "Please select at least one enabled model."
|
247 |
|
248 |
if len(selected_models) > 1:
|
249 |
if task_type == "Classification":
|
250 |
if downstream_model == "Default Settings":
|
251 |
downstream_model = "DefaultClassifier"
|
252 |
params = None
|
253 |
+
|
254 |
+
result, state["roc_auc"], state["fpr"], state["tpr"], state["x_batch"], state["y_batch"] = \
|
255 |
+
fm4m.multi_modal(model_list=selected_models,
|
256 |
+
downstream_model=downstream_model,
|
257 |
+
params = params,
|
258 |
+
dataset=dataset)
|
259 |
|
260 |
elif task_type == "Regression":
|
261 |
if downstream_model == "Default Settings":
|
262 |
downstream_model = "DefaultRegressor"
|
263 |
params = None
|
264 |
|
265 |
+
result, state["RMSE"], state["y_batch_test"], state["y_prob"], state["x_batch"], state["y_batch"] = \
|
266 |
+
fm4m.multi_modal(model_list=selected_models,
|
267 |
+
downstream_model=downstream_model,
|
268 |
+
params=params,
|
269 |
+
dataset=dataset)
|
270 |
|
271 |
else:
|
272 |
if task_type == "Classification":
|
|
|
274 |
downstream_model = "DefaultClassifier"
|
275 |
params = None
|
276 |
|
277 |
+
result, state["roc_auc"], state["fpr"], state["tpr"], state["x_batch"], state["y_batch"] = \
|
278 |
+
fm4m.single_modal(model=selected_models[0],
|
279 |
+
downstream_model=downstream_model,
|
280 |
+
params=params,
|
281 |
+
dataset=dataset)
|
282 |
|
283 |
elif task_type == "Regression":
|
284 |
if downstream_model == "Default Settings":
|
285 |
downstream_model = "DefaultRegressor"
|
286 |
params = None
|
287 |
|
288 |
+
result, state["RMSE"], state["y_batch_test"], state["y_prob"], state["x_batch"], state["y_batch"] = \
|
289 |
+
fm4m.single_modal(model=selected_models[0],
|
290 |
+
downstream_model=downstream_model,
|
291 |
+
params=params,
|
292 |
+
dataset=dataset)
|
293 |
|
294 |
if result == None:
|
295 |
result = "Data & Model Setting is incorrect"
|
296 |
except Exception as e:
|
297 |
+
return f"An error occurred: {e}"
|
298 |
+
return f"{result}"
|
299 |
|
300 |
|
301 |
# Function to handle plot display
|
|
|
609 |
|
610 |
eval_button.click(display_eval,
|
611 |
inputs=[model_checkbox, selected_columns_message, task_radiobutton, output, fusion_radiobutton, state],
|
612 |
+
outputs=eval_output)
|
613 |
|
614 |
plot_radio.change(display_plot, inputs=[plot_radio, state], outputs=plot_output)
|
615 |
|