Harshit494 commited on
Commit
78b0ca2
Β·
verified Β·
1 Parent(s): e1b9946

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -31
app.py CHANGED
@@ -52,9 +52,9 @@ UPPER_3TO1 = {k.upper(): v for k, v in THREE_TO_ONE.items()}
52
 
53
  EXAMPLES = [
54
  {
55
- "pdb": "6M0J", "label": "6M0J", "subtitle": "ACE2 ↔ SARS-CoV-2 RBD",
56
- "desc": "Human ACE2 bound to SARS-CoV-2 spike RBD. Chain A = ACE2, Chain E = RBD.",
57
- "mode": "Protein-Protein", "chain_a": "A", "chain_b": "E",
58
  },
59
  {
60
  "pdb": "1BRS", "label": "1BRS", "subtitle": "Barnase ↔ Barstar",
@@ -1125,12 +1125,12 @@ def build_ui():
1125
  ppi_a = gr.Textbox(
1126
  label="Target Protein β€” Seq A",
1127
  placeholder="Paste FASTA or raw sequence… | = chain separator",
1128
- lines=6, max_lines=12,
1129
  )
1130
  ppi_b = gr.Textbox(
1131
  label="Binder Protein β€” Seq B ( | = chain separator)",
1132
  placeholder="Paste FASTA or raw sequence…",
1133
- lines=6, max_lines=12,
1134
  )
1135
 
1136
  # Ab-Ag input panel
@@ -1139,19 +1139,19 @@ def build_ui():
1139
  ab_ag = gr.Textbox(
1140
  label="Antigen / Target β€” Seq A",
1141
  placeholder="Antigen sequence…",
1142
- lines=6, max_lines=12, scale=2,
1143
  )
1144
  with gr.Column(scale=3):
1145
  with gr.Row():
1146
  ab_h = gr.Textbox(
1147
  label="Heavy Chain (H)",
1148
  placeholder="VH sequence…",
1149
- lines=6, max_lines=12,
1150
  )
1151
  ab_l = gr.Textbox(
1152
  label="Light Chain (L)",
1153
  placeholder="VL sequence…",
1154
- lines=6, max_lines=12,
1155
  )
1156
 
1157
  with gr.Row():
@@ -1161,12 +1161,30 @@ def build_ui():
1161
 
1162
  result_html = gr.HTML("")
1163
 
1164
- # ─── Lower section: examples + visualizations ─────
1165
  with gr.Row():
1166
- with gr.Column(scale=2):
1167
- gr.HTML('<div class="sec-hdr">Quick Examples</div>')
 
 
 
 
 
 
 
 
 
 
 
 
 
1168
 
1169
- # Render example cards + buttons
 
 
 
 
 
1170
  example_buttons = []
1171
  for ex in EXAMPLES:
1172
  gr.HTML(
@@ -1178,23 +1196,7 @@ def build_ui():
1178
  b = gr.Button(f"⬇ Load {ex['pdb']}", size="sm")
1179
  example_buttons.append((b, ex))
1180
 
1181
- gr.HTML('<div class="sec-hdr" style="margin-top:18px">Custom PDB Fetch</div>')
1182
- pdb_in = gr.Textbox(label="PDB ID", placeholder="6M0J, 1BRS, 2VXQ…")
1183
-
1184
- # PPI chain selectors
1185
- with gr.Row(visible=True) as ppi_chains_row:
1186
- ca_in = gr.Textbox(label="Side A chain(s)", placeholder="A or A,B")
1187
- cb_in = gr.Textbox(label="Side B chain(s)", placeholder="E or B,C")
1188
-
1189
- # Ab-Ag chain selectors
1190
- with gr.Row(visible=False) as abag_chains_row:
1191
- ch_in = gr.Textbox(label="Heavy", placeholder="H")
1192
- cl_in = gr.Textbox(label="Light", placeholder="L")
1193
- cag_in = gr.Textbox(label="Antigen", placeholder="A or A,B")
1194
-
1195
- fetch_btn = gr.Button("πŸ” Fetch PDB", variant="secondary")
1196
- pdb_info_md = gr.Markdown("")
1197
-
1198
  with gr.Column(scale=3):
1199
  with gr.Tabs():
1200
  with gr.Tab("🧬 Structure"):
@@ -1262,7 +1264,7 @@ with Integrated Gradients explainability.
1262
  | Viewer | PDB filtered to **selected chains only** |
1263
  | Hardware | HF ZeroGPU (dynamic A100); CPU fallback supported |
1264
 
1265
- **Examples** Β· **6M0J** β€” ACE2 ↔ SARS-CoV-2 RBD &nbsp;Β·&nbsp; **1BRS** β€” Barnase ↔ Barstar
1266
 
1267
  πŸ€— [Harshit494/BALM-PPI](https://huggingface.co/Harshit494/BALM-PPI) &nbsp;Β·&nbsp;
1268
  πŸ’» [rgorantla04/BALM-PPI](https://github.com/rgorantla04/BALM-PPI)
@@ -1365,4 +1367,8 @@ if __name__ == "__main__":
1365
  traceback.print_exc()
1366
 
1367
  demo = build_ui()
1368
- demo.queue(max_size=20).launch(css=CSS, theme=gr.themes.Soft())
 
 
 
 
 
52
 
53
  EXAMPLES = [
54
  {
55
+ "pdb": "1YCR", "label": "1YCR", "subtitle": "MDM2 ↔ p53",
56
+ "desc": "MDM2 oncoprotein bound to the p53 transactivation peptide. Chain A = MDM2, Chain B = p53. Classic drug-target complex.",
57
+ "mode": "Protein-Protein", "chain_a": "A", "chain_b": "B",
58
  },
59
  {
60
  "pdb": "1BRS", "label": "1BRS", "subtitle": "Barnase ↔ Barstar",
 
1125
  ppi_a = gr.Textbox(
1126
  label="Target Protein β€” Seq A",
1127
  placeholder="Paste FASTA or raw sequence… | = chain separator",
1128
+ lines=4, max_lines=8,
1129
  )
1130
  ppi_b = gr.Textbox(
1131
  label="Binder Protein β€” Seq B ( | = chain separator)",
1132
  placeholder="Paste FASTA or raw sequence…",
1133
+ lines=4, max_lines=8,
1134
  )
1135
 
1136
  # Ab-Ag input panel
 
1139
  ab_ag = gr.Textbox(
1140
  label="Antigen / Target β€” Seq A",
1141
  placeholder="Antigen sequence…",
1142
+ lines=4, max_lines=8, scale=2,
1143
  )
1144
  with gr.Column(scale=3):
1145
  with gr.Row():
1146
  ab_h = gr.Textbox(
1147
  label="Heavy Chain (H)",
1148
  placeholder="VH sequence…",
1149
+ lines=4, max_lines=8,
1150
  )
1151
  ab_l = gr.Textbox(
1152
  label="Light Chain (L)",
1153
  placeholder="VL sequence…",
1154
+ lines=4, max_lines=8,
1155
  )
1156
 
1157
  with gr.Row():
 
1161
 
1162
  result_html = gr.HTML("")
1163
 
1164
+ # ─── Lower section: PDB controls + visualizations ─────
1165
  with gr.Row():
1166
+ # ── LEFT: Custom PDB Fetch ───────────────────
1167
+ with gr.Column(scale=1, min_width=240):
1168
+ gr.HTML('<div class="sec-hdr">Custom PDB Fetch</div>')
1169
+ pdb_in = gr.Textbox(label="PDB ID", placeholder="1YCR, 1BRS, 2VXQ…")
1170
+
1171
+ # PPI chain selectors
1172
+ with gr.Group(visible=True) as ppi_chains_row:
1173
+ ca_in = gr.Textbox(label="Side A chain(s)", placeholder="A or A,B")
1174
+ cb_in = gr.Textbox(label="Side B chain(s)", placeholder="B or B,C")
1175
+
1176
+ # Ab-Ag chain selectors
1177
+ with gr.Group(visible=False) as abag_chains_row:
1178
+ ch_in = gr.Textbox(label="Heavy", placeholder="H")
1179
+ cl_in = gr.Textbox(label="Light", placeholder="L")
1180
+ cag_in = gr.Textbox(label="Antigen", placeholder="A or A,B")
1181
 
1182
+ fetch_btn = gr.Button("πŸ” Fetch PDB", variant="secondary", size="sm")
1183
+ pdb_info_md = gr.Markdown("")
1184
+
1185
+ # ── MIDDLE: Quick Examples ───────────────────
1186
+ with gr.Column(scale=1, min_width=240):
1187
+ gr.HTML('<div class="sec-hdr">Quick Examples</div>')
1188
  example_buttons = []
1189
  for ex in EXAMPLES:
1190
  gr.HTML(
 
1196
  b = gr.Button(f"⬇ Load {ex['pdb']}", size="sm")
1197
  example_buttons.append((b, ex))
1198
 
1199
+ # ── RIGHT: Visualizations ────────────────────
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1200
  with gr.Column(scale=3):
1201
  with gr.Tabs():
1202
  with gr.Tab("🧬 Structure"):
 
1264
  | Viewer | PDB filtered to **selected chains only** |
1265
  | Hardware | HF ZeroGPU (dynamic A100); CPU fallback supported |
1266
 
1267
+ **Examples** Β· **1YCR** β€” MDM2 ↔ p53 &nbsp;Β·&nbsp; **1BRS** β€” Barnase ↔ Barstar
1268
 
1269
  πŸ€— [Harshit494/BALM-PPI](https://huggingface.co/Harshit494/BALM-PPI) &nbsp;Β·&nbsp;
1270
  πŸ’» [rgorantla04/BALM-PPI](https://github.com/rgorantla04/BALM-PPI)
 
1367
  traceback.print_exc()
1368
 
1369
  demo = build_ui()
1370
+ demo.queue(max_size=20).launch(
1371
+ css=CSS,
1372
+ theme=gr.themes.Soft(),
1373
+ ssr_mode=False, # cleaner logs; SSR is experimental in Gradio 6
1374
+ )