Spaces:
Sleeping
Sleeping
igashov
commited on
Commit
•
6f4a6fd
1
Parent(s):
6264fac
radio
Browse files
app.py
CHANGED
@@ -113,7 +113,6 @@ def generate(input_file):
|
|
113 |
molecule = Chem.RemoveAllHs(molecule)
|
114 |
name = '.'.join(path.split('/')[-1].split('.')[:-1])
|
115 |
inp_sdf = f'results/input_{name}.sdf'
|
116 |
-
inp_xyz = f'results/input_{name}.xyz'
|
117 |
except Exception as e:
|
118 |
return f'Could not read the molecule: {e}'
|
119 |
|
@@ -122,7 +121,6 @@ def generate(input_file):
|
|
122 |
|
123 |
with Chem.SDWriter(inp_sdf) as w:
|
124 |
w.write(molecule)
|
125 |
-
Chem.MolToXYZFile(molecule, inp_xyz)
|
126 |
|
127 |
positions, one_hot, charges = parse_molecule(molecule, is_geom=True)
|
128 |
anchors = np.zeros_like(charges)
|
@@ -203,6 +201,7 @@ with demo:
|
|
203 |
output_files = gr.File(file_count='multiple', label='Output Files')
|
204 |
with gr.Column():
|
205 |
gr.Markdown('## Visualization')
|
|
|
206 |
visualization = gr.HTML()
|
207 |
samples = gr.Radio(interactive=True, type='index', label='Samples')
|
208 |
|
@@ -211,16 +210,16 @@ with demo:
|
|
211 |
inputs=[input_file],
|
212 |
outputs=[visualization],
|
213 |
)
|
214 |
-
button.click(
|
215 |
-
fn=generate,
|
216 |
-
inputs=[input_file],
|
217 |
-
outputs=[visualization, output_files, samples],
|
218 |
-
)
|
219 |
examples.click(
|
220 |
fn=lambda idx: [f'examples/example_{idx+1}.sdf', show_input(f'examples/example_{idx+1}.sdf')],
|
221 |
inputs=[examples],
|
222 |
outputs=[input_file, visualization]
|
223 |
)
|
|
|
|
|
|
|
|
|
|
|
224 |
samples.change(
|
225 |
fn=draw_sample,
|
226 |
inputs=[samples, output_files],
|
|
|
113 |
molecule = Chem.RemoveAllHs(molecule)
|
114 |
name = '.'.join(path.split('/')[-1].split('.')[:-1])
|
115 |
inp_sdf = f'results/input_{name}.sdf'
|
|
|
116 |
except Exception as e:
|
117 |
return f'Could not read the molecule: {e}'
|
118 |
|
|
|
121 |
|
122 |
with Chem.SDWriter(inp_sdf) as w:
|
123 |
w.write(molecule)
|
|
|
124 |
|
125 |
positions, one_hot, charges = parse_molecule(molecule, is_geom=True)
|
126 |
anchors = np.zeros_like(charges)
|
|
|
201 |
output_files = gr.File(file_count='multiple', label='Output Files')
|
202 |
with gr.Column():
|
203 |
gr.Markdown('## Visualization')
|
204 |
+
gr.Markdown('Below you will see input and output molecules')
|
205 |
visualization = gr.HTML()
|
206 |
samples = gr.Radio(interactive=True, type='index', label='Samples')
|
207 |
|
|
|
210 |
inputs=[input_file],
|
211 |
outputs=[visualization],
|
212 |
)
|
|
|
|
|
|
|
|
|
|
|
213 |
examples.click(
|
214 |
fn=lambda idx: [f'examples/example_{idx+1}.sdf', show_input(f'examples/example_{idx+1}.sdf')],
|
215 |
inputs=[examples],
|
216 |
outputs=[input_file, visualization]
|
217 |
)
|
218 |
+
button.click(
|
219 |
+
fn=generate,
|
220 |
+
inputs=[input_file],
|
221 |
+
outputs=[visualization, output_files, samples],
|
222 |
+
)
|
223 |
samples.change(
|
224 |
fn=draw_sample,
|
225 |
inputs=[samples, output_files],
|