Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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": "
|
| 56 |
-
"desc": "
|
| 57 |
-
"mode": "Protein-Protein", "chain_a": "A", "chain_b": "
|
| 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=
|
| 1129 |
)
|
| 1130 |
ppi_b = gr.Textbox(
|
| 1131 |
label="Binder Protein β Seq B ( | = chain separator)",
|
| 1132 |
placeholder="Paste FASTA or raw sequenceβ¦",
|
| 1133 |
-
lines=
|
| 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=
|
| 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=
|
| 1150 |
)
|
| 1151 |
ab_l = gr.Textbox(
|
| 1152 |
label="Light Chain (L)",
|
| 1153 |
placeholder="VL sequenceβ¦",
|
| 1154 |
-
lines=
|
| 1155 |
)
|
| 1156 |
|
| 1157 |
with gr.Row():
|
|
@@ -1161,12 +1161,30 @@ def build_ui():
|
|
| 1161 |
|
| 1162 |
result_html = gr.HTML("")
|
| 1163 |
|
| 1164 |
-
# βββ Lower section:
|
| 1165 |
with gr.Row():
|
| 1166 |
-
|
| 1167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1168 |
|
| 1169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
-
|
| 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** Β· **
|
| 1266 |
|
| 1267 |
π€ [Harshit494/BALM-PPI](https://huggingface.co/Harshit494/BALM-PPI) Β·
|
| 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(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 Β· **1BRS** β Barnase β Barstar
|
| 1268 |
|
| 1269 |
π€ [Harshit494/BALM-PPI](https://huggingface.co/Harshit494/BALM-PPI) Β·
|
| 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 |
+
)
|