Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -328,11 +328,11 @@ def sub_rings(smile_in: str, number_subs = 1) -> str:
|
|
| 328 |
|
| 329 |
img = Draw.MolsToGridImage(mols, legends=legends, molsPerRow=3, subImgSize=(200,200),useSVG=False,returnPNG=False)
|
| 330 |
|
| 331 |
-
|
| 332 |
out_text = "Invalid SMILES string"
|
| 333 |
img = None
|
| 334 |
|
| 335 |
-
|
| 336 |
|
| 337 |
with gr.Blocks() as gradio_app:
|
| 338 |
gr.Markdown(
|
|
@@ -358,6 +358,8 @@ with gr.Blocks() as gradio_app:
|
|
| 358 |
|
| 359 |
|
| 360 |
smile = gr.Textbox(label="SMILES for hit expansion")
|
|
|
|
|
|
|
| 361 |
with gr.Row():
|
| 362 |
mask_btn = gr.Button("Generate analogues with Mask-filling.")
|
| 363 |
sub_btn = gr.Button("Generate analogues with substitutions.")
|
|
@@ -367,7 +369,7 @@ with gr.Blocks() as gradio_app:
|
|
| 367 |
mol_pic = gr.Image(label="Molecule Images:")
|
| 368 |
|
| 369 |
|
| 370 |
-
@mask_btn.click(inputs=[smile], outputs=[results, mol_pic])
|
| 371 |
def do_genmask(smile):
|
| 372 |
return gen_mask(smile)
|
| 373 |
|
|
@@ -375,10 +377,6 @@ with gr.Blocks() as gradio_app:
|
|
| 375 |
def do_subrings(smile):
|
| 376 |
return sub_rings(smile)
|
| 377 |
|
| 378 |
-
@smile.submit(inputs=[smile], outputs=[results, mol_pic])
|
| 379 |
-
def do_genmask(smile,struct_type):
|
| 380 |
-
return gen_mask(smile)
|
| 381 |
-
|
| 382 |
|
| 383 |
if __name__ == "__main__":
|
| 384 |
gradio_app.launch(mcp_server=True)
|
|
|
|
| 328 |
|
| 329 |
img = Draw.MolsToGridImage(mols, legends=legends, molsPerRow=3, subImgSize=(200,200),useSVG=False,returnPNG=False)
|
| 330 |
|
| 331 |
+
except:
|
| 332 |
out_text = "Invalid SMILES string"
|
| 333 |
img = None
|
| 334 |
|
| 335 |
+
return None, None
|
| 336 |
|
| 337 |
with gr.Blocks() as gradio_app:
|
| 338 |
gr.Markdown(
|
|
|
|
| 358 |
|
| 359 |
|
| 360 |
smile = gr.Textbox(label="SMILES for hit expansion")
|
| 361 |
+
|
| 362 |
+
|
| 363 |
with gr.Row():
|
| 364 |
mask_btn = gr.Button("Generate analogues with Mask-filling.")
|
| 365 |
sub_btn = gr.Button("Generate analogues with substitutions.")
|
|
|
|
| 369 |
mol_pic = gr.Image(label="Molecule Images:")
|
| 370 |
|
| 371 |
|
| 372 |
+
@mask_btn.click(inputs=[smile, percent_mask], outputs=[results, mol_pic])
|
| 373 |
def do_genmask(smile):
|
| 374 |
return gen_mask(smile)
|
| 375 |
|
|
|
|
| 377 |
def do_subrings(smile):
|
| 378 |
return sub_rings(smile)
|
| 379 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 380 |
|
| 381 |
if __name__ == "__main__":
|
| 382 |
gradio_app.launch(mcp_server=True)
|