Spaces:
Runtime error
Runtime error
Eachan Johnson
commited on
Commit
·
8e992e9
1
Parent(s):
ed1d3fc
Update rif
Browse files- app.py +15 -22
- example-data/examples.json +1 -1
app.py
CHANGED
|
@@ -315,28 +315,21 @@ def predict_file(
|
|
| 315 |
+ prediction_cols + other_cols
|
| 316 |
+ ['smiles', "mwt", "clogp"]
|
| 317 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
|
| 319 |
if return_pd:
|
| 320 |
-
return (
|
| 321 |
-
prediction_df,
|
| 322 |
-
gr.Dataframe(
|
| 323 |
-
label="Predictions",
|
| 324 |
-
value=prediction_df,
|
| 325 |
-
pinned_columns=3,
|
| 326 |
-
visible=True,
|
| 327 |
-
wrap=True,
|
| 328 |
-
column_widths=[75] * prediction_df.shape[1],
|
| 329 |
-
),
|
| 330 |
-
)
|
| 331 |
else:
|
| 332 |
-
return gr.Dataframe(
|
| 333 |
-
label="Predictions",
|
| 334 |
-
value=prediction_df,
|
| 335 |
-
pinned_columns=3,
|
| 336 |
-
visible=True,
|
| 337 |
-
wrap=True,
|
| 338 |
-
column_widths=[125] * prediction_df.shape[1],
|
| 339 |
-
)
|
| 340 |
|
| 341 |
|
| 342 |
def draw_one(
|
|
@@ -464,7 +457,7 @@ def _load_then_predict_then_download_then_reveal_plot(
|
|
| 464 |
file,
|
| 465 |
return_pd=True,
|
| 466 |
)
|
| 467 |
-
df, df_gr = predict_file(
|
| 468 |
df,
|
| 469 |
column=column,
|
| 470 |
input_representation=input_representation,
|
|
@@ -474,11 +467,10 @@ def _load_then_predict_then_download_then_reveal_plot(
|
|
| 474 |
return_pd=True,
|
| 475 |
)
|
| 476 |
print_err(df.head())
|
| 477 |
-
plot_dropdown = get_dropdown_options(df, _type="number")
|
| 478 |
return (
|
| 479 |
df_gr,
|
| 480 |
download_table(df),
|
| 481 |
-
) +
|
| 482 |
|
| 483 |
|
| 484 |
def _initial_setup():
|
|
@@ -808,6 +800,7 @@ if __name__ == "__main__":
|
|
| 808 |
],
|
| 809 |
outputs=[
|
| 810 |
input_dataframe,
|
|
|
|
| 811 |
],
|
| 812 |
)
|
| 813 |
|
|
|
|
| 315 |
+ prediction_cols + other_cols
|
| 316 |
+ ['smiles', "mwt", "clogp"]
|
| 317 |
]
|
| 318 |
+
plot_dropdown = get_dropdown_options(prediction_df, _type="number")
|
| 319 |
+
|
| 320 |
+
gradio_opts = {
|
| 321 |
+
"label": "Predictions",
|
| 322 |
+
"value": prediction_df,
|
| 323 |
+
"pinned_columns": 3,
|
| 324 |
+
"visible": True,
|
| 325 |
+
"wrap": True,
|
| 326 |
+
"column_widths": [125] * prediction_df.shape[1],
|
| 327 |
+
}
|
| 328 |
|
| 329 |
if return_pd:
|
| 330 |
+
return ((prediction_df, gr.Dataframe(**gradio_opts),),) + (plot_dropdown,) * 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 331 |
else:
|
| 332 |
+
return (gr.Dataframe(**gradio_opts),) + (plot_dropdown,) * 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 333 |
|
| 334 |
|
| 335 |
def draw_one(
|
|
|
|
| 457 |
file,
|
| 458 |
return_pd=True,
|
| 459 |
)
|
| 460 |
+
(df, df_gr), plot_opts = predict_file(
|
| 461 |
df,
|
| 462 |
column=column,
|
| 463 |
input_representation=input_representation,
|
|
|
|
| 467 |
return_pd=True,
|
| 468 |
)
|
| 469 |
print_err(df.head())
|
|
|
|
| 470 |
return (
|
| 471 |
df_gr,
|
| 472 |
download_table(df),
|
| 473 |
+
) + plot_opts
|
| 474 |
|
| 475 |
|
| 476 |
def _initial_setup():
|
|
|
|
| 800 |
],
|
| 801 |
outputs=[
|
| 802 |
input_dataframe,
|
| 803 |
+
*plot_dropdowns,
|
| 804 |
],
|
| 805 |
)
|
| 806 |
|
example-data/examples.json
CHANGED
|
@@ -50,7 +50,7 @@
|
|
| 50 |
"Zosurabalpin: CN1[C@H](C(=O)NCC2=C(C=CC=C2SC3=C(CN[C@H](C(=O)N[C@H](C1=O)CCCCN)CCCN)C=CC=N3)C4=CC=C(C=C4)C(=O)O)CC5=CNC6=CC=CC=C65",
|
| 51 |
"Plazomicin: C[C@@]1(CO[C@@H]([C@@H]([C@H]1NC)O)O[C@H]2[C@@H](C[C@@H]([C@H]([C@@H]2O)O[C@@H]3[C@@H](CC=C(O3)CNCCO)N)N)NC(=O)[C@H](CCN)O)O",
|
| 52 |
"Gentamicin: CC(C1CCC(C(O1)OC2C(CC(C(C2O)OC3C(C(C(CO3)(C)O)NC)O)N)N)N)NC",
|
| 53 |
-
"Rifampicin: C[C@H]1/C=C/C=C(\\C(=O)NC2=C(C(=C3C(=C2O)C(=C(C4=C3C(=O)[C@](O4)(O/C=C/[C@@H]([C@H]([C@H]([C@@H]([C@@H]([C@@H]([C@H]1O)C)O)C)OC(=O)C)C)OC)C)C)O)O)/C=N/N5CCN(CC5)C)/
|
| 54 |
],
|
| 55 |
"species": [
|
| 56 |
"Acinetobacter baumannii"
|
|
|
|
| 50 |
"Zosurabalpin: CN1[C@H](C(=O)NCC2=C(C=CC=C2SC3=C(CN[C@H](C(=O)N[C@H](C1=O)CCCCN)CCCN)C=CC=N3)C4=CC=C(C=C4)C(=O)O)CC5=CNC6=CC=CC=C65",
|
| 51 |
"Plazomicin: C[C@@]1(CO[C@@H]([C@@H]([C@H]1NC)O)O[C@H]2[C@@H](C[C@@H]([C@H]([C@@H]2O)O[C@@H]3[C@@H](CC=C(O3)CNCCO)N)N)NC(=O)[C@H](CCN)O)O",
|
| 52 |
"Gentamicin: CC(C1CCC(C(O1)OC2C(CC(C(C2O)OC3C(C(C(CO3)(C)O)NC)O)N)N)N)NC",
|
| 53 |
+
"Rifampicin: C[C@H]1/C=C/C=C(\\C(=O)NC2=C(C(=C3C(=C2O)C(=C(C4=C3C(=O)[C@](O4)(O/C=C/[C@@H]([C@H]([C@H]([C@@H]([C@@H]([C@@H]([C@H]1O)C)O)C)OC(=O)C)C)OC)C)C)O)O)/C=N/N5CCN(CC5)C)/CC"
|
| 54 |
],
|
| 55 |
"species": [
|
| 56 |
"Acinetobacter baumannii"
|