Spaces:
Running
Running
Eachan Johnson
commited on
Commit
·
2bfd9e8
1
Parent(s):
7908b96
Fix duplicated smiles issue
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@
|
|
2 |
|
3 |
from typing import Iterable, List, Optional, Union
|
4 |
import csv
|
5 |
-
from functools import partial
|
6 |
from io import TextIOWrapper
|
7 |
import itertools
|
8 |
import json
|
@@ -234,12 +233,10 @@ def convert_file(
|
|
234 |
output_representation: Union[str, Iterable[str]] = 'smiles'
|
235 |
):
|
236 |
output_representation = cast(output_representation, to=list)
|
237 |
-
|
238 |
-
|
239 |
-
gr.Info(message, duration=10)
|
240 |
-
print_err(df.head())
|
241 |
print_err(message)
|
242 |
-
|
243 |
errors, df = converter(
|
244 |
df=df,
|
245 |
column=column,
|
@@ -247,7 +244,7 @@ def convert_file(
|
|
247 |
output_representation=output_representation,
|
248 |
)
|
249 |
df = df[
|
250 |
-
|
251 |
[col for col in df if col not in output_representation]
|
252 |
]
|
253 |
all_err = sum(err for key, err in errors.items())
|
@@ -300,15 +297,12 @@ def predict_file(
|
|
300 |
+ [column]
|
301 |
+ prediction_cols
|
302 |
)
|
303 |
-
other_cols =
|
304 |
-
col for col in prediction_df
|
305 |
-
if col not in main_cols
|
306 |
-
]
|
307 |
prediction_df = prediction_df[
|
308 |
['id', 'inchikey']
|
309 |
+ [column]
|
310 |
+ prediction_cols + other_cols
|
311 |
-
+ [
|
312 |
]
|
313 |
plot_dropdown = get_dropdown_options(prediction_df, _type="number")
|
314 |
plot_dropdown = (plot_dropdown,) * 5
|
|
|
2 |
|
3 |
from typing import Iterable, List, Optional, Union
|
4 |
import csv
|
|
|
5 |
from io import TextIOWrapper
|
6 |
import itertools
|
7 |
import json
|
|
|
233 |
output_representation: Union[str, Iterable[str]] = 'smiles'
|
234 |
):
|
235 |
output_representation = cast(output_representation, to=list)
|
236 |
+
message = f"Converting from {input_representation} to {"".join(output_representation)}..."
|
237 |
+
gr.Info(message, duration=5)
|
|
|
|
|
238 |
print_err(message)
|
239 |
+
print_err(df.head())
|
240 |
errors, df = converter(
|
241 |
df=df,
|
242 |
column=column,
|
|
|
244 |
output_representation=output_representation,
|
245 |
)
|
246 |
df = df[
|
247 |
+
output_representation +
|
248 |
[col for col in df if col not in output_representation]
|
249 |
]
|
250 |
all_err = sum(err for key, err in errors.items())
|
|
|
297 |
+ [column]
|
298 |
+ prediction_cols
|
299 |
)
|
300 |
+
other_cols = list(set(prediction_df) - main_cols)
|
|
|
|
|
|
|
301 |
prediction_df = prediction_df[
|
302 |
['id', 'inchikey']
|
303 |
+ [column]
|
304 |
+ prediction_cols + other_cols
|
305 |
+
+ ["mwt", "clogp"]
|
306 |
]
|
307 |
plot_dropdown = get_dropdown_options(prediction_df, _type="number")
|
308 |
plot_dropdown = (plot_dropdown,) * 5
|