Spaces:
Running
Running
Eachan Johnson
commited on
Commit
·
35e1fc5
1
Parent(s):
a4896d3
Tidy code, alter column widths
Browse files
app.py
CHANGED
@@ -215,21 +215,18 @@ def predict_one(
|
|
215 |
+ prediction_cols
|
216 |
+ ['smiles', 'inchikey', "mwt", "clogp"]
|
217 |
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
218 |
if return_pd:
|
219 |
-
return (
|
220 |
-
df,
|
221 |
-
gr.DataFrame(
|
222 |
-
df,
|
223 |
-
pinned_columns=3,
|
224 |
-
visible=True,
|
225 |
-
)
|
226 |
-
)
|
227 |
else:
|
228 |
-
return gr.DataFrame(
|
229 |
-
df,
|
230 |
-
pinned_columns=3,
|
231 |
-
visible=True,
|
232 |
-
)
|
233 |
|
234 |
def convert_file(
|
235 |
df: pd.DataFrame,
|
@@ -323,7 +320,7 @@ def predict_file(
|
|
323 |
"pinned_columns": 3,
|
324 |
"visible": True,
|
325 |
"wrap": True,
|
326 |
-
"column_widths": [
|
327 |
}
|
328 |
|
329 |
if return_pd:
|
@@ -803,6 +800,7 @@ if __name__ == "__main__":
|
|
803 |
download,
|
804 |
*plot_dropdowns,
|
805 |
],
|
|
|
806 |
).then(
|
807 |
lambda: gr.Button(visible=True),
|
808 |
outputs=[plot_button],
|
@@ -824,6 +822,7 @@ if __name__ == "__main__":
|
|
824 |
left_plot_inputs["color"],
|
825 |
],
|
826 |
outputs=[plots["left"]],
|
|
|
827 |
).then(
|
828 |
plot_x_vs_y,
|
829 |
inputs=[
|
|
|
215 |
+ prediction_cols
|
216 |
+ ['smiles', 'inchikey', "mwt", "clogp"]
|
217 |
]
|
218 |
+
gradio_opts = {
|
219 |
+
"label": "Predictions",
|
220 |
+
"value": df,
|
221 |
+
"pinned_columns": 3,
|
222 |
+
"visible": True,
|
223 |
+
"wrap": True,
|
224 |
+
"column_widths": [200] * df.shape[1],
|
225 |
+
}
|
226 |
if return_pd:
|
227 |
+
return df, gr.DataFrame(**gradio_opts)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
else:
|
229 |
+
return gr.DataFrame(**gradio_opts)
|
|
|
|
|
|
|
|
|
230 |
|
231 |
def convert_file(
|
232 |
df: pd.DataFrame,
|
|
|
320 |
"pinned_columns": 3,
|
321 |
"visible": True,
|
322 |
"wrap": True,
|
323 |
+
"column_widths": [200] * prediction_df.shape[1],
|
324 |
}
|
325 |
|
326 |
if return_pd:
|
|
|
800 |
download,
|
801 |
*plot_dropdowns,
|
802 |
],
|
803 |
+
scroll_to_output=True,
|
804 |
).then(
|
805 |
lambda: gr.Button(visible=True),
|
806 |
outputs=[plot_button],
|
|
|
822 |
left_plot_inputs["color"],
|
823 |
],
|
824 |
outputs=[plots["left"]],
|
825 |
+
scroll_to_output=True,
|
826 |
).then(
|
827 |
plot_x_vs_y,
|
828 |
inputs=[
|