Spaces:
Running
Running
update app.py
Browse files
app.py
CHANGED
|
@@ -79,7 +79,7 @@ smiles_image_mapping = {
|
|
| 79 |
"Mol 5": {"smiles": "C=CCS[C@@H](C)CC(=O)OCC", "image": "img/img5.png"} # Example SMILES for chloroethane
|
| 80 |
}
|
| 81 |
|
| 82 |
-
datasets = ["
|
| 83 |
|
| 84 |
models_enabled = ["SELFIES-TED", "MHG-GED", "MolFormer", "SMI-TED"]
|
| 85 |
|
|
@@ -115,12 +115,26 @@ def evaluate_and_log(models, dataset, task_type, eval_output):
|
|
| 115 |
return log_df
|
| 116 |
|
| 117 |
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
# Load images for selection
|
| 122 |
def load_image(path):
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
|
| 126 |
# Function to handle image selection
|
|
@@ -393,8 +407,8 @@ def display_plot(plot_type):
|
|
| 393 |
|
| 394 |
# Predefined dataset paths (these should be adjusted to your file paths)
|
| 395 |
predefined_datasets = {
|
| 396 |
-
"BACE": f"./data/bace/train.csv, ./data/bace/test.csv, smiles, Class",
|
| 397 |
-
"ESOL": f"./data/esol/train.csv, ./data/esol/test.csv, smiles, prop",
|
| 398 |
}
|
| 399 |
|
| 400 |
|
|
@@ -426,16 +440,6 @@ def handle_dataset_selection(selected_dataset):
|
|
| 426 |
return gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(
|
| 427 |
visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
| 428 |
else:
|
| 429 |
-
#[dataset_name, train_file, train_display, test_file, test_display, predefined_display,
|
| 430 |
-
# input_column_selector, output_column_selector]
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
# Load the predefined dataset from its local path
|
| 435 |
-
#return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(
|
| 436 |
-
# visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 437 |
-
#return gr.update(visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(
|
| 438 |
-
# visible=False), gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 439 |
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(
|
| 440 |
visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 441 |
|
|
|
|
| 79 |
"Mol 5": {"smiles": "C=CCS[C@@H](C)CC(=O)OCC", "image": "img/img5.png"} # Example SMILES for chloroethane
|
| 80 |
}
|
| 81 |
|
| 82 |
+
datasets = ["Load Custom Dataset"]
|
| 83 |
|
| 84 |
models_enabled = ["SELFIES-TED", "MHG-GED", "MolFormer", "SMI-TED"]
|
| 85 |
|
|
|
|
| 115 |
return log_df
|
| 116 |
|
| 117 |
|
| 118 |
+
try:
|
| 119 |
+
log_df = pd.read_csv('log.csv', index_col=0)
|
| 120 |
+
except:
|
| 121 |
+
log_df = pd.DataFrame({"":[],
|
| 122 |
+
'Selected Models': [],
|
| 123 |
+
'Dataset': [],
|
| 124 |
+
'Task': [],
|
| 125 |
+
'Result': []
|
| 126 |
+
})
|
| 127 |
+
csv_file_path = 'log.csv'
|
| 128 |
+
log_df.to_csv(csv_file_path, index=False)
|
| 129 |
|
| 130 |
|
| 131 |
# Load images for selection
|
| 132 |
def load_image(path):
|
| 133 |
+
try:
|
| 134 |
+
return Image.open(smiles_image_mapping[path]["image"])# Image.1open(path)
|
| 135 |
+
except:
|
| 136 |
+
pass
|
| 137 |
+
|
| 138 |
|
| 139 |
|
| 140 |
# Function to handle image selection
|
|
|
|
| 407 |
|
| 408 |
# Predefined dataset paths (these should be adjusted to your file paths)
|
| 409 |
predefined_datasets = {
|
| 410 |
+
#"BACE": f"./data/bace/train.csv, ./data/bace/test.csv, smiles, Class",
|
| 411 |
+
#"ESOL": f"./data/esol/train.csv, ./data/esol/test.csv, smiles, prop",
|
| 412 |
}
|
| 413 |
|
| 414 |
|
|
|
|
| 440 |
return gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(
|
| 441 |
visible=True), gr.update(visible=False), gr.update(visible=True), gr.update(visible=True)
|
| 442 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 443 |
return gr.update(visible=True), gr.update(visible=False), gr.update(visible=False), gr.update(
|
| 444 |
visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=False)
|
| 445 |
|