Spaces:
Runtime error
Runtime error
igashov
commited on
Commit
·
6264fac
1
Parent(s):
f58a645
radio
Browse files
app.py
CHANGED
|
@@ -91,6 +91,13 @@ def show_input(input_file):
|
|
| 91 |
return output.IFRAME_TEMPLATE.format(html=html)
|
| 92 |
|
| 93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
def generate(input_file):
|
| 95 |
if input_file is None:
|
| 96 |
return ''
|
|
@@ -152,7 +159,6 @@ def generate(input_file):
|
|
| 152 |
out_xyz = f'results/output_{i+1}_{name}_.xyz'
|
| 153 |
out_sdf = f'results/output_{i+1}_{name}_.sdf'
|
| 154 |
subprocess.run(f'obabel {out_xyz} -O {out_sdf}', shell=True)
|
| 155 |
-
out_files.append(out_xyz)
|
| 156 |
out_files.append(out_sdf)
|
| 157 |
print('Converted to SDF')
|
| 158 |
|
|
@@ -167,7 +173,7 @@ def generate(input_file):
|
|
| 167 |
)
|
| 168 |
return [
|
| 169 |
output.IFRAME_TEMPLATE.format(html=html),
|
| 170 |
-
[inp_sdf
|
| 171 |
gr.Radio.update(
|
| 172 |
choices=['Sample 1', 'Sample 2', 'Sample 3', 'Sample 4', 'Sample 5'],
|
| 173 |
value='Sample 1',
|
|
@@ -197,8 +203,8 @@ with demo:
|
|
| 197 |
output_files = gr.File(file_count='multiple', label='Output Files')
|
| 198 |
with gr.Column():
|
| 199 |
gr.Markdown('## Visualization')
|
| 200 |
-
samples = gr.Radio(interactive=True, type='index', label='Samples')
|
| 201 |
visualization = gr.HTML()
|
|
|
|
| 202 |
|
| 203 |
input_file.change(
|
| 204 |
fn=show_input,
|
|
@@ -215,5 +221,10 @@ with demo:
|
|
| 215 |
inputs=[examples],
|
| 216 |
outputs=[input_file, visualization]
|
| 217 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
|
| 219 |
demo.launch(server_name=args.ip)
|
|
|
|
| 91 |
return output.IFRAME_TEMPLATE.format(html=html)
|
| 92 |
|
| 93 |
|
| 94 |
+
def draw_sample(idx, output_files):
|
| 95 |
+
print(idx)
|
| 96 |
+
print(output_files)
|
| 97 |
+
print(output_files[0].name)
|
| 98 |
+
return
|
| 99 |
+
|
| 100 |
+
|
| 101 |
def generate(input_file):
|
| 102 |
if input_file is None:
|
| 103 |
return ''
|
|
|
|
| 159 |
out_xyz = f'results/output_{i+1}_{name}_.xyz'
|
| 160 |
out_sdf = f'results/output_{i+1}_{name}_.sdf'
|
| 161 |
subprocess.run(f'obabel {out_xyz} -O {out_sdf}', shell=True)
|
|
|
|
| 162 |
out_files.append(out_sdf)
|
| 163 |
print('Converted to SDF')
|
| 164 |
|
|
|
|
| 173 |
)
|
| 174 |
return [
|
| 175 |
output.IFRAME_TEMPLATE.format(html=html),
|
| 176 |
+
[inp_sdf] + out_files,
|
| 177 |
gr.Radio.update(
|
| 178 |
choices=['Sample 1', 'Sample 2', 'Sample 3', 'Sample 4', 'Sample 5'],
|
| 179 |
value='Sample 1',
|
|
|
|
| 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 |
|
| 209 |
input_file.change(
|
| 210 |
fn=show_input,
|
|
|
|
| 221 |
inputs=[examples],
|
| 222 |
outputs=[input_file, visualization]
|
| 223 |
)
|
| 224 |
+
samples.change(
|
| 225 |
+
fn=draw_sample,
|
| 226 |
+
inputs=[samples, output_files],
|
| 227 |
+
outputs=[],
|
| 228 |
+
)
|
| 229 |
|
| 230 |
demo.launch(server_name=args.ip)
|