yinuozhang commited on
Commit
07cdc1e
·
1 Parent(s): 6179bb6
Files changed (2) hide show
  1. app.py +28 -3
  2. requirements.txt +2 -1
app.py CHANGED
@@ -1044,7 +1044,7 @@ def process_input(
1044
  #img_linear if 'img_linear' in locals() else None,
1045
  #structure_files if structure_files else []
1046
  )
1047
-
1048
  iface = gr.Interface(
1049
  fn=process_input,
1050
  inputs=[
@@ -1068,7 +1068,7 @@ iface = gr.Interface(
1068
  ),
1069
  ],
1070
  title="Peptide Structure Analyzer and Visualizer",
1071
- description="""
1072
  Analyze and visualize peptide structures from SMILES notation:
1073
  1. Validates if the input is a peptide structure
1074
  2. Determines if the peptide is cyclic
@@ -1089,9 +1089,34 @@ iface = gr.Interface(
1089
  ```
1090
  CC(C)C[C@H]1C(=O)N(C)[C@@H](Cc2ccccc2)C(=O)NCC(=O)N[C@H](C(=O)N2CCCCC2)CC(=O)N(C)CC(=O)N[C@@H]([C@@H](C)O)C(=O)N(C)[C@@H](C)C(=O)N[C@@H](COC(C)(C)C)C(=O)N(C)[C@@H](Cc2ccccc2)C(=O)N1C
1091
  ```
1092
- """,
1093
  flagging_mode="never"
1094
  )
1095
 
1096
  if __name__ == "__main__":
1097
  iface.launch(share=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1044
  #img_linear if 'img_linear' in locals() else None,
1045
  #structure_files if structure_files else []
1046
  )
1047
+ """
1048
  iface = gr.Interface(
1049
  fn=process_input,
1050
  inputs=[
 
1068
  ),
1069
  ],
1070
  title="Peptide Structure Analyzer and Visualizer",
1071
+ description='''
1072
  Analyze and visualize peptide structures from SMILES notation:
1073
  1. Validates if the input is a peptide structure
1074
  2. Determines if the peptide is cyclic
 
1089
  ```
1090
  CC(C)C[C@H]1C(=O)N(C)[C@@H](Cc2ccccc2)C(=O)NCC(=O)N[C@H](C(=O)N2CCCCC2)CC(=O)N(C)CC(=O)N[C@@H]([C@@H](C)O)C(=O)N(C)[C@@H](C)C(=O)N[C@@H](COC(C)(C)C)C(=O)N(C)[C@@H](Cc2ccccc2)C(=O)N1C
1091
  ```
1092
+ ''',
1093
  flagging_mode="never"
1094
  )
1095
 
1096
  if __name__ == "__main__":
1097
  iface.launch(share=True)
1098
+ """
1099
+ from fastapi import FastAPI
1100
+ import gradio as gr
1101
+
1102
+ # 1) Make a FastAPI with no OpenAPI/docs routes
1103
+ app = FastAPI(docs_url=None, redoc_url=None, openapi_url=None)
1104
+
1105
+ # 2) Build your Interface as before
1106
+ iface = gr.Interface(
1107
+ fn=process_input,
1108
+ inputs=[ gr.Textbox(label="Enter SMILES string", lines=2) ],
1109
+ outputs=[
1110
+ gr.Textbox(label="Analysis Results", lines=10),
1111
+ gr.Image(label="2D Structure with Annotations", type="pil"),
1112
+ ],
1113
+ title="Peptide Structure Analyzer and Visualizer",
1114
+ flagging_mode="never"
1115
+ )
1116
+
1117
+ # 3) Mount it at “/”
1118
+ app = gr.mount_gradio_app(app, iface, path="/")
1119
+
1120
+ if __name__ == "__main__":
1121
+ import uvicorn
1122
+ uvicorn.run(app, host="0.0.0.0", port=7860)
requirements.txt CHANGED
@@ -4,4 +4,5 @@ rdkit==2023.9.1
4
  Pillow==10.0.0
5
  matplotlib==3.7.1
6
  numpy>=1.24.3
7
- gradio-client==1.7.2
 
 
4
  Pillow==10.0.0
5
  matplotlib==3.7.1
6
  numpy>=1.24.3
7
+ gradio-client==1.7.2
8
+ fastapi