yinuozhang commited on
Commit
ad4a786
·
1 Parent(s): b871fd6

add more functions

Browse files
Files changed (1) hide show
  1. app.py +18 -14
app.py CHANGED
@@ -436,6 +436,9 @@ def process_input(smiles_input=None, file_obj=None, show_linear=False):
436
  return "No input provided.", None, None
437
 
438
  # Create Gradio interface
 
 
 
439
  iface = gr.Interface(
440
  fn=process_input,
441
  inputs=[
@@ -446,12 +449,10 @@ iface = gr.Interface(
446
  ),
447
  gr.File(
448
  label="Or upload a text file with SMILES",
449
- file_types=[".txt"],
450
- type="binary"
451
  ),
452
  gr.Checkbox(
453
- label="Show linear representation",
454
- value=False
455
  )
456
  ],
457
  outputs=[
@@ -460,13 +461,10 @@ iface = gr.Interface(
460
  lines=10
461
  ),
462
  gr.Image(
463
- label="2D Structure with Annotations",
464
- type="pil"
465
  ),
466
  gr.Image(
467
- label="Linear Representation",
468
- type="pil",
469
- visible=lambda x: x # Only show when checkbox is checked
470
  )
471
  ],
472
  title="Peptide Structure Analyzer and Visualizer",
@@ -481,12 +479,18 @@ iface = gr.Interface(
481
  Input: Either enter a SMILES string directly or upload a text file
482
  """,
483
  examples=[
484
- # Example cyclic peptide with Proline
485
- ["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", None, True],
486
- # Example cyclic peptide with ester bond
487
- ["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", None, True]
 
 
 
 
 
 
488
  ],
489
- allow_flagging="never"
490
  )
491
  # Launch the app
492
  if __name__ == "__main__":
 
436
  return "No input provided.", None, None
437
 
438
  # Create Gradio interface
439
+ # [Previous imports and functions remain the same]
440
+
441
+ # Create Gradio interface with fixed examples
442
  iface = gr.Interface(
443
  fn=process_input,
444
  inputs=[
 
449
  ),
450
  gr.File(
451
  label="Or upload a text file with SMILES",
452
+ file_types=[".txt"]
 
453
  ),
454
  gr.Checkbox(
455
+ label="Show linear representation"
 
456
  )
457
  ],
458
  outputs=[
 
461
  lines=10
462
  ),
463
  gr.Image(
464
+ label="2D Structure with Annotations"
 
465
  ),
466
  gr.Image(
467
+ label="Linear Representation"
 
 
468
  )
469
  ],
470
  title="Peptide Structure Analyzer and Visualizer",
 
479
  Input: Either enter a SMILES string directly or upload a text file
480
  """,
481
  examples=[
482
+ [ # Example 1
483
+ "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",
484
+ None,
485
+ True
486
+ ],
487
+ [ # Example 2
488
+ "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",
489
+ None,
490
+ True
491
+ ]
492
  ],
493
+ flagging_mode="never"
494
  )
495
  # Launch the app
496
  if __name__ == "__main__":