igashov commited on
Commit
b7813c6
1 Parent(s): f1c7e08
Files changed (1) hide show
  1. app.py +9 -13
app.py CHANGED
@@ -71,8 +71,10 @@ def read_molecule(path):
71
  def show_input(input_file):
72
  if input_file is None:
73
  return ''
74
-
75
- path = input_file.name
 
 
76
  extension = path.split('.')[-1]
77
  if extension not in ['sdf', 'pdb', 'mol', 'mol2']:
78
  msg = output.INVALID_FORMAT_MSG.format(extension=extension)
@@ -169,8 +171,6 @@ with demo:
169
  example1 = gr.Button('Example 1')
170
  with gr.Column():
171
  example2 = gr.Button('Example 2')
172
- with gr.Column():
173
- example3 = gr.Button('Example 3')
174
 
175
  button = gr.Button('Generate Linker!')
176
  gr.Markdown('')
@@ -192,20 +192,16 @@ with demo:
192
  )
193
 
194
  example1.click(
195
- fn=lambda: 'examples/example_1.sdf',
196
  inputs=[],
197
- outputs=[input_file],
198
  )
199
  example2.click(
200
- fn=lambda: 'examples/example_2.sdf',
201
  inputs=[],
202
- outputs=[input_file],
203
- )
204
- example3.click(
205
- fn=lambda: 'examples/example_1.sdf',
206
- inputs=[],
207
- outputs=[input_file],
208
  )
 
209
  # examples = gr.Examples(
210
  # examples=[['examples/example_1.sdf'], ['examples/example_2.sdf']],
211
  # inputs=[input_file],
 
71
  def show_input(input_file):
72
  if input_file is None:
73
  return ''
74
+ if isinstance(input_file, str):
75
+ path = input_file
76
+ else:
77
+ path = input_file.name
78
  extension = path.split('.')[-1]
79
  if extension not in ['sdf', 'pdb', 'mol', 'mol2']:
80
  msg = output.INVALID_FORMAT_MSG.format(extension=extension)
 
171
  example1 = gr.Button('Example 1')
172
  with gr.Column():
173
  example2 = gr.Button('Example 2')
 
 
174
 
175
  button = gr.Button('Generate Linker!')
176
  gr.Markdown('')
 
192
  )
193
 
194
  example1.click(
195
+ fn=lambda: ['examples/example_1.sdf', show_input('examples/example_1.sdf')],
196
  inputs=[],
197
+ outputs=[input_file, visualization],
198
  )
199
  example2.click(
200
+ fn=lambda: ['examples/example_2.sdf', show_input('examples/example_2.sdf')],
201
  inputs=[],
202
+ outputs=[input_file, visualization],
 
 
 
 
 
203
  )
204
+
205
  # examples = gr.Examples(
206
  # examples=[['examples/example_1.sdf'], ['examples/example_2.sdf']],
207
  # inputs=[input_file],