yinuozhang commited on
Commit
0bbb5ea
·
1 Parent(s): e1d6be0

add more functions

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -435,6 +435,7 @@ def process_input(smiles_input=None, file_obj=None, show_linear=False):
435
 
436
  return "No input provided.", None, None
437
 
 
438
  iface = gr.Interface(
439
  fn=process_input,
440
  inputs=[
@@ -445,8 +446,7 @@ iface = gr.Interface(
445
  ),
446
  gr.File(
447
  label="Or upload a text file with SMILES",
448
- file_types=[".txt"],
449
- optional=True # Make the file input optional
450
  ),
451
  gr.Checkbox(
452
  label="Show linear representation"
@@ -478,12 +478,12 @@ iface = gr.Interface(
478
  examples=[
479
  [
480
  "CC(C)C[C@@H]1NC(=O)[C@@H]2CCCN2C(=O)[C@@H](CC(C)C)NC(=O)[C@@H](CC(C)C)N(C)C(=O)[C@H](C)NC(=O)[C@H](Cc2ccccc2)NC1=O",
481
- gr.File.update(visible=False), # Hide file input in examples
482
  True
483
  ],
484
  [
485
  "CC(C)C[C@@H]1OC(=O)[C@H](C)NC(=O)[C@H](C(C)C)OC(=O)[C@H](C)N(C)C(=O)[C@@H](C)NC(=O)[C@@H](Cc2ccccc2)N(C)C1=O",
486
- gr.File.update(visible=False), # Hide file input in examples
487
  True
488
  ]
489
  ],
 
435
 
436
  return "No input provided.", None, None
437
 
438
+ # Create Gradio interface with simplified examples
439
  iface = gr.Interface(
440
  fn=process_input,
441
  inputs=[
 
446
  ),
447
  gr.File(
448
  label="Or upload a text file with SMILES",
449
+ file_types=[".txt"]
 
450
  ),
451
  gr.Checkbox(
452
  label="Show linear representation"
 
478
  examples=[
479
  [
480
  "CC(C)C[C@@H]1NC(=O)[C@@H]2CCCN2C(=O)[C@@H](CC(C)C)NC(=O)[C@@H](CC(C)C)N(C)C(=O)[C@H](C)NC(=O)[C@H](Cc2ccccc2)NC1=O",
481
+ "", # Empty string for file input
482
  True
483
  ],
484
  [
485
  "CC(C)C[C@@H]1OC(=O)[C@H](C)NC(=O)[C@H](C(C)C)OC(=O)[C@H](C)N(C)C(=O)[C@@H](C)NC(=O)[C@@H](Cc2ccccc2)N(C)C1=O",
486
+ "", # Empty string for file input
487
  True
488
  ]
489
  ],