Spaces:
Runtime error

LoocasGoose Claude Opus 4.5 commited on
Commit
00a0b23
·
1 Parent(s): 65318d8

Improve Gradio UI with modern design and better UX

Browse files

Changes:
- Add gradient header with paper link
- Reorganize into tabs (Search / About)
- Add quick example buttons (EGFR, P53, Insulin)
- Better parameter grouping with visual hierarchy
- Info boxes for available thresholds
- Cleaner results layout with side-by-side summary
- Add custom CSS for styling
- Use Gradio Soft theme
- Streamlined export section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

protein_conformal/backend/gradio_interface.py CHANGED
@@ -968,240 +968,283 @@ def export_current_results(format_type: str) -> Tuple[Dict[str, Any], Optional[s
968
  def create_interface():
969
  """
970
  Create and configure the Gradio interface for protein conformal prediction
971
-
972
  Returns:
973
  Gradio interface object
974
  """
975
- with gr.Blocks(title="Protein Conformal Prediction") as interface:
976
- gr.Markdown("# Protein Conformal Prediction")
977
-
978
- # Information section explaining the concepts
979
- with gr.Accordion("About Conformal Prediction", open=False):
980
- gr.Markdown("""
981
- ## What is Conformal Prediction?
982
-
983
- Conformal prediction is a statistical framework that provides mathematically rigorous uncertainty quantification for any machine learning model.
984
-
985
- In protein search, it allows us to control either:
986
-
987
- - **False Discovery Rate (FDR)**: The proportion of false positives among all positive predictions.
988
- - Formula: FDR = FP / (FP + TP)
989
- - Controlling FDR ensures that among the proteins you identify as matches, only a small percentage are incorrect.
990
- - Use FDR control when you want to minimize the chance of following up on false leads.
991
-
992
- - **False Negative Rate (FNR)**: The proportion of missed true positives among all actual positives.
993
- - Formula: FNR = FN / (FN + TP)
994
- - Controlling FNR ensures you don't miss too many true matches.
995
- - Use FNR control when you want to ensure comprehensive coverage, even at the cost of including some false positives.
996
-
997
- ### How Conformal Risk Control Works
998
-
999
- This implementation uses the conformal risk–control framework from "Functional protein mining with conformal guarantees" (Boger et al., 2025).
1000
-
1001
- The key idea is to choose the smallest similarity threshold λ̂ such that the empirical risk on a held-out calibration set
1002
- does not exceed α (up to a small finite-sample correction):
1003
-
1004
- λ̂ = inf{λ: (1/n)∑ℓ(Xi,Cλ(Xi)) ≤ α - (1-α)/n}
1005
-
1006
- Where:
1007
- - α is your risk tolerance
1008
- - ℓ is the loss function (FDR or FNR)
1009
- - Cλ(X) is the retrieval set for threshold λ
1010
-
1011
- This formula guarantees that the expected risk E[ℓ(X,Cλ̂(X))] ≤ α under exchangeability.
1012
-
1013
- ### Probability Calibration
1014
-
1015
- In addition to thresholding, we use the Venn-Abers method with isotonic regression to transform similarity scores
1016
- into calibrated probabilities, which can enrich interpretation of results.
1017
-
1018
- The Venn-Abers prediction method:
1019
- 1. Takes a raw similarity score and adds it to the calibration data with both positive and negative labels
1020
- 2. Fits isotonic regression models on both versions of the augmented dataset
1021
- 3. Returns two probability estimates (p0, p1) that provide guaranteed bounds on the true probability
1022
- 4. The average (p0+p1)/2 serves as our calibrated probability for downstream interpretation
1023
-
1024
- ### Calibration Data
1025
-
1026
- For this implementation, we use precomputed calibration probabilities stored in a CSV file with:
1027
- - Similarity scores between protein pairs
1028
- - Probability values for exact matches (prob_exact_p0, prob_exact_p1)
1029
- - Probability values for partial matches (prob_partial_p0, prob_partial_p1)
1030
-
1031
- All available calibration points are used automatically for every user query to provide the most reliable
1032
- statistical guarantees for either FDR or FNR metrics.
1033
- """)
1034
-
1035
- # Main interface
1036
- with gr.Row():
1037
- with gr.Column():
1038
- # Input section
1039
- gr.Markdown("## 1. Input Protein Sequences (FASTA format)")
1040
-
1041
- # FASTA input - always visible now
1042
- fasta_text = gr.TextArea(
1043
- lines=6,
1044
- label="Enter FASTA content",
1045
- placeholder=">Protein1\nMKTVRQERLKSIVRILERSKEPVSGAQLAEELSVSRQVIVQDIAYLRSLGYNIVATPRGYVLAGG"
1046
- )
1047
- upload_file = gr.File(
1048
- label="Or upload a FASTA file",
1049
- file_types=[".fasta", ".fa", ".txt"]
1050
- )
1051
-
1052
- # Keep Protein-Vec enabled without exposing a UI toggle.
1053
- use_protein_vec = gr.State(value=True)
1054
- custom_embeddings_state = gr.State(value=None)
1055
-
1056
- with gr.Column():
1057
- # Conformal Parameters section
1058
- gr.Markdown("## 2. Conformal Parameters")
1059
- gr.Markdown("""
1060
- Select which statistical guarantee you want to control and your risk level alpha.
1061
- """)
1062
-
1063
- risk_type = gr.Radio(
1064
- ["FDR", "FNR"],
1065
- label="Risk Type to Control",
1066
- value="FDR",
1067
- info="FDR: Controls false positives among results. FNR: Controls missed true matches."
1068
- )
1069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1070
  gr.Markdown("""
1071
- **Available α values:**
1072
- - **FDR**: α=0.1 only (paper-verified threshold)
1073
- - **FNR**: α ∈ {0.001, 0.005, 0.01, 0.02, 0.05, 0.1, 0.15, 0.2}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1074
  """)
1075
 
1076
- risk_value = gr.Slider(
1077
- minimum=0.001,
1078
- maximum=0.2,
1079
- value=0.1,
1080
- step=0.001,
1081
- label="Risk Level Alpha",
1082
- info="For FDR, only α=0.1 is calibrated. For FNR, nearest available α will be used."
1083
- )
1084
 
1085
- match_type = gr.Radio(
1086
- ["Exact", "Partial"],
1087
- label="Match Type",
1088
- value="Exact",
1089
- info="Exact: All Pfam domains match. Partial: At least one Pfam domain matches."
1090
- )
1091
-
1092
- # Database selection
1093
- with gr.Accordion("Database Options", open=False):
1094
- gr.Markdown("""
1095
- ## Database Selection
1096
-
1097
- Select which pre-embedded database to search against:
1098
-
1099
- ### Available Databases:
1100
-
1101
- **UniProt** - A comprehensive collection of protein sequences and functional annotations. Provides broad coverage across diverse species and protein families.
1102
-
1103
- **SCOPE** - Structural Classification of Proteins database containing protein domains with known 3D structures. Useful for structural and functional studies.
1104
-
1105
- **Custom** - Upload your own database files. Requires two files:
1106
- 1. Embedding file (.npy): A NumPy array of protein embeddings
1107
- 2. Metadata file: Either a FASTA file (.fasta, .fa) or a tab-separated file (.tsv) with sequence metadata
1108
- """)
1109
-
1110
- db_type = gr.Radio(
1111
- ["UniProt", "SCOPE", "Custom"],
1112
- label="Database Type",
1113
- value="UniProt",
1114
- info="Select which database to search against"
1115
- )
1116
 
1117
- max_results_slider = gr.Slider(
1118
- minimum=100,
1119
- maximum=5000,
1120
- value=1000,
1121
- step=100,
1122
- label="Max Retrieval Results (k)",
1123
- info="Increase to return more nearest neighbors per query (higher values increase runtime)"
1124
- )
1125
-
1126
- # Add custom file upload components (only for custom DB)
1127
- custom_lookup_upload = gr.File(
1128
- label="Upload Custom Embedding File (.npy)",
1129
- file_types=[".npy"],
1130
- visible=False,
1131
- )
1132
-
1133
- custom_metadata_upload = gr.File(
1134
- label="Upload Custom Metadata File (.fasta, .fa, or .tsv)",
1135
- file_types=[".fasta", ".fa", ".tsv"],
1136
- visible=False,
1137
- )
1138
 
1139
- lookup_db_state = gr.State(value=DEFAULT_LOOKUP_EMBEDDING)
1140
- metadata_db_state = gr.State(value=DEFAULT_LOOKUP_METADATA)
1141
-
1142
- # Submit button
1143
- submit_btn = gr.Button("Search", variant="primary")
1144
-
1145
- # Results section
1146
- gr.Markdown("## 3. Results")
1147
- with gr.Row():
1148
- with gr.Column():
1149
- # Conformal prediction summary
1150
- results_summary = gr.JSON(label="Conformal Prediction Results")
1151
-
1152
- # Add a DataFrame for displaying results in a tabular format
1153
- # Note: Headers will be determined by the DataFrame columns
1154
- # For FASTA lookup: query_seq, query_meta, lookup_seq, D_score, prob_exact, lookup_meta
1155
- # For TSV lookup: query_seq, query_meta, lookup_seq, D_score, prob_exact, lookup_entry, lookup_pfam, lookup_protein_names
1156
- results_table = gr.Dataframe(
1157
- label="Results Table (All Matches - Click Column Headers to Sort)",
1158
- wrap=True,
1159
- interactive=True # Enable interactions like sorting
1160
- )
1161
-
1162
- # Export results
1163
- with gr.Accordion("Export Results", open=False):
1164
- with gr.Row():
1165
- with gr.Column():
1166
- export_format = gr.Radio(
1167
- ["csv", "json"],
1168
- label="Export Format",
1169
- value="csv"
1170
- )
1171
- export_btn = gr.Button("Export Results")
1172
- export_status = gr.JSON(label="Export Status")
1173
- export_download = gr.File(
1174
- label="Download Results",
1175
- interactive=False
1176
- )
1177
-
1178
- gr.Markdown("""
1179
- ### Citation
1180
-
1181
- If you use this tool in your research, please cite:
1182
-
1183
- ```
1184
- @article{boger2025functional,
1185
- title={Functional protein mining with conformal guarantees},
1186
- author={Boger, Ron S and Chithrananda, Seyone and Angelopoulos, Anastasios N and Yoon, Peter H and Jordan, Michael I and Doudna, Jennifer A},
1187
- journal={Nature Communications},
1188
- volume={16},
1189
- number={1},
1190
- pages={85},
1191
- year={2025},
1192
- publisher={Nature Publishing Group UK London}
1193
- }
1194
- ```
1195
- """)
1196
-
1197
  # Export functionality
1198
  export_btn.click(
1199
  fn=export_current_results,
1200
  inputs=[export_format],
1201
  outputs=[export_status, export_download]
1202
  )
1203
-
1204
- # Main prediction submission - hardcode input_type as "fasta_format"
1205
  submit_btn.click(
1206
  fn=lambda fasta, upload, risk_t, risk_v, max_k, use_pv, custom_emb, lookup, metadata, custom_lookup, custom_meta, m_type:
1207
  process_input("", fasta, upload, "fasta_format", risk_t, risk_v, max_k, use_pv, custom_emb, lookup, metadata, custom_lookup, custom_meta, m_type),
@@ -1214,7 +1257,7 @@ def create_interface():
1214
  ],
1215
  outputs=[results_summary, results_table]
1216
  )
1217
-
1218
  # Database selection event handler
1219
  def update_database_selection(db_choice):
1220
  if db_choice == "UniProt":
@@ -1238,7 +1281,7 @@ def create_interface():
1238
  gr.update(visible=True),
1239
  gr.update(visible=True),
1240
  )
1241
-
1242
  db_type.change(
1243
  fn=update_database_selection,
1244
  inputs=[db_type],
 
968
  def create_interface():
969
  """
970
  Create and configure the Gradio interface for protein conformal prediction
971
+
972
  Returns:
973
  Gradio interface object
974
  """
975
+ # Custom CSS for better styling
976
+ custom_css = """
977
+ .header-container {
978
+ text-align: center;
979
+ padding: 20px;
980
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
981
+ border-radius: 10px;
982
+ margin-bottom: 20px;
983
+ }
984
+ .header-title {
985
+ color: white;
986
+ font-size: 2.5em;
987
+ margin-bottom: 10px;
988
+ }
989
+ .header-subtitle {
990
+ color: rgba(255,255,255,0.9);
991
+ font-size: 1.1em;
992
+ }
993
+ .info-box {
994
+ background-color: #f0f7ff;
995
+ border-left: 4px solid #667eea;
996
+ padding: 15px;
997
+ margin: 10px 0;
998
+ border-radius: 0 8px 8px 0;
999
+ }
1000
+ .warning-box {
1001
+ background-color: #fff7e6;
1002
+ border-left: 4px solid #faad14;
1003
+ padding: 15px;
1004
+ margin: 10px 0;
1005
+ border-radius: 0 8px 8px 0;
1006
+ }
1007
+ .success-box {
1008
+ background-color: #f6ffed;
1009
+ border-left: 4px solid #52c41a;
1010
+ padding: 15px;
1011
+ margin: 10px 0;
1012
+ border-radius: 0 8px 8px 0;
1013
+ }
1014
+ .parameter-card {
1015
+ background: #fafafa;
1016
+ padding: 15px;
1017
+ border-radius: 8px;
1018
+ border: 1px solid #e8e8e8;
1019
+ }
1020
+ """
1021
+
1022
+ with gr.Blocks(title="Conformal Protein Retrieval", css=custom_css, theme=gr.themes.Soft()) as interface:
1023
+ # Header
1024
+ gr.HTML("""
1025
+ <div style="text-align: center; padding: 20px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 10px; margin-bottom: 20px;">
1026
+ <h1 style="color: white; font-size: 2.2em; margin-bottom: 5px;">Conformal Protein Retrieval</h1>
1027
+ <p style="color: rgba(255,255,255,0.9); font-size: 1.1em; margin: 0;">
1028
+ Functional protein mining with statistical guarantees
1029
+ </p>
1030
+ <p style="color: rgba(255,255,255,0.7); font-size: 0.9em; margin-top: 5px;">
1031
+ Based on <a href="https://www.nature.com/articles/s41467-024-55676-y" target="_blank" style="color: #fff;">Boger et al., Nature Communications 2025</a>
1032
+ </p>
1033
+ </div>
1034
+ """)
1035
+
1036
+ # Quick info box
1037
+ gr.HTML("""
1038
+ <div style="background-color: #f0f7ff; border-left: 4px solid #667eea; padding: 12px 15px; margin: 10px 0; border-radius: 0 8px 8px 0;">
1039
+ <strong>How it works:</strong> Enter protein sequences, select your risk control type (FDR or FNR),
1040
+ and get statistically guaranteed results with calibrated match probabilities.
1041
+ </div>
1042
+ """)
1043
+
1044
+ # Main interface with tabs
1045
+ with gr.Tabs():
1046
+ with gr.TabItem("Search"):
1047
+ with gr.Row():
1048
+ # Left column - Input
1049
+ with gr.Column(scale=1):
1050
+ gr.Markdown("### Input Protein Sequences")
1051
+
1052
+ fasta_text = gr.TextArea(
1053
+ lines=8,
1054
+ label="FASTA Content",
1055
+ placeholder=">sp|P00533|EGFR_HUMAN Epidermal growth factor receptor\nMRPSGTAGAALLALLAALCPASRALEEKKVCQGTSNKLTQLGTFEDHFLSLQRMFNNCEVVLGNLEITYVQRNYDLSFLKTIQEVAGYVLIALNTVERIPLE\n\n>sp|P04637|P53_HUMAN Cellular tumor antigen p53\nMEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGP"
1056
+ )
 
 
 
 
 
 
 
 
 
 
 
 
1057
 
1058
+ upload_file = gr.File(
1059
+ label="Or Upload FASTA File",
1060
+ file_types=[".fasta", ".fa", ".txt"]
1061
+ )
1062
+
1063
+ # Example buttons
1064
+ gr.Markdown("**Quick Examples:**")
1065
+ with gr.Row():
1066
+ example_btn1 = gr.Button("EGFR", size="sm")
1067
+ example_btn2 = gr.Button("P53", size="sm")
1068
+ example_btn3 = gr.Button("Insulin", size="sm")
1069
+
1070
+ use_protein_vec = gr.State(value=True)
1071
+ custom_embeddings_state = gr.State(value=None)
1072
+
1073
+ # Right column - Parameters
1074
+ with gr.Column(scale=1):
1075
+ gr.Markdown("### Search Parameters")
1076
+
1077
+ with gr.Group():
1078
+ risk_type = gr.Radio(
1079
+ ["FDR", "FNR"],
1080
+ label="Risk Control Type",
1081
+ value="FDR",
1082
+ info="FDR: Minimize false positives | FNR: Minimize missed matches"
1083
+ )
1084
+
1085
+ risk_value = gr.Slider(
1086
+ minimum=0.001,
1087
+ maximum=0.2,
1088
+ value=0.1,
1089
+ step=0.001,
1090
+ label="Risk Level (α)",
1091
+ info="Lower = stricter threshold, fewer but more confident results"
1092
+ )
1093
+
1094
+ match_type = gr.Radio(
1095
+ ["Exact", "Partial"],
1096
+ label="Match Type",
1097
+ value="Exact",
1098
+ info="Exact: All Pfam domains match | Partial: At least one matches"
1099
+ )
1100
+
1101
+ # Calibrated thresholds info
1102
+ gr.HTML("""
1103
+ <div style="background-color: #fff7e6; border-left: 4px solid #faad14; padding: 10px 12px; margin: 10px 0; border-radius: 0 8px 8px 0; font-size: 0.9em;">
1104
+ <strong>Available thresholds:</strong><br>
1105
+ • FDR: α=0.1 only (paper-verified)<br>
1106
+ • FNR: α ∈ {0.001, 0.005, 0.01, 0.02, 0.05, 0.1, 0.15, 0.2}
1107
+ </div>
1108
+ """)
1109
+
1110
+ # Database options in accordion
1111
+ with gr.Accordion("Advanced Options", open=False):
1112
+ db_type = gr.Radio(
1113
+ ["UniProt", "SCOPE", "Custom"],
1114
+ label="Database",
1115
+ value="UniProt",
1116
+ info="Select lookup database"
1117
+ )
1118
+
1119
+ max_results_slider = gr.Slider(
1120
+ minimum=100,
1121
+ maximum=5000,
1122
+ value=1000,
1123
+ step=100,
1124
+ label="Max Results (k)",
1125
+ info="Maximum neighbors per query"
1126
+ )
1127
+
1128
+ custom_lookup_upload = gr.File(
1129
+ label="Custom Embeddings (.npy)",
1130
+ file_types=[".npy"],
1131
+ visible=False,
1132
+ )
1133
+
1134
+ custom_metadata_upload = gr.File(
1135
+ label="Custom Metadata (.fasta/.tsv)",
1136
+ file_types=[".fasta", ".fa", ".tsv"],
1137
+ visible=False,
1138
+ )
1139
+
1140
+ lookup_db_state = gr.State(value=DEFAULT_LOOKUP_EMBEDDING)
1141
+ metadata_db_state = gr.State(value=DEFAULT_LOOKUP_METADATA)
1142
+
1143
+ # Submit button
1144
+ submit_btn = gr.Button("Search", variant="primary", size="lg")
1145
+
1146
+ # Results section
1147
+ gr.Markdown("### Results")
1148
+
1149
+ with gr.Row():
1150
+ with gr.Column(scale=2):
1151
+ results_table = gr.Dataframe(
1152
+ label="Matches (click headers to sort)",
1153
+ wrap=True,
1154
+ interactive=True,
1155
+ height=400
1156
+ )
1157
+
1158
+ with gr.Column(scale=1):
1159
+ results_summary = gr.JSON(label="Search Summary")
1160
+
1161
+ with gr.Row():
1162
+ export_format = gr.Radio(
1163
+ ["csv", "json"],
1164
+ label="Export Format",
1165
+ value="csv",
1166
+ scale=2
1167
+ )
1168
+ export_btn = gr.Button("Export", size="sm", scale=1)
1169
+
1170
+ export_status = gr.JSON(label="Export Status", visible=True)
1171
+ export_download = gr.File(label="Download", interactive=False)
1172
+
1173
+ with gr.TabItem("About"):
1174
  gr.Markdown("""
1175
+ ## What is Conformal Prediction?
1176
+
1177
+ Conformal prediction provides **mathematically rigorous uncertainty quantification** for machine learning predictions.
1178
+
1179
+ ### Risk Control Types
1180
+
1181
+ | Type | Formula | Use When |
1182
+ |------|---------|----------|
1183
+ | **FDR** | FP / (FP + TP) | You want high precision - most retrieved results should be correct |
1184
+ | **FNR** | FN / (FN + TP) | You want high recall - don't miss true matches |
1185
+
1186
+ ### How It Works
1187
+
1188
+ 1. **Embedding**: Your protein sequences are converted to 512-dimensional vectors using Protein-Vec
1189
+ 2. **Search**: FAISS finds the k-nearest neighbors in the lookup database
1190
+ 3. **Thresholding**: Conformal prediction selects a similarity threshold λ̂ that guarantees:
1191
+ - E[Risk] ≤ α (your specified risk level)
1192
+ 4. **Calibration**: Venn-Abers provides calibrated probability estimates for each match
1193
+
1194
+ ### The Math
1195
+
1196
+ The threshold is chosen as:
1197
+ ```
1198
+ λ̂ = inf{λ: (1/n)∑ℓ(Xᵢ, Cλ(Xᵢ)) ≤ α - (1-α)/n}
1199
+ ```
1200
+
1201
+ This guarantees that the expected risk E[ℓ(X, Cλ̂(X))] ≤ α under exchangeability.
1202
+
1203
+ ### Citation
1204
+
1205
+ ```bibtex
1206
+ @article{boger2025functional,
1207
+ title={Functional protein mining with conformal guarantees},
1208
+ author={Boger, Ron S and Chithrananda, Seyone and Angelopoulos, Anastasios N
1209
+ and Yoon, Peter H and Jordan, Michael I and Doudna, Jennifer A},
1210
+ journal={Nature Communications},
1211
+ volume={16},
1212
+ pages={85},
1213
+ year={2025}
1214
+ }
1215
+ ```
1216
  """)
1217
 
1218
+ # Example sequences
1219
+ EXAMPLE_EGFR = """>sp|P00533|EGFR_HUMAN Epidermal growth factor receptor
1220
+ MRPSGTAGAALLALLAALCPASRALEEKKVCQGTSNKLTQLGTFEDHFLSLQRMFNNCEVVLGNLEITYVQRNYDLSFLKTIQEVAGYVLIALNTVERIPLE"""
 
 
 
 
 
1221
 
1222
+ EXAMPLE_P53 = """>sp|P04637|P53_HUMAN Cellular tumor antigen p53
1223
+ MEEPQSDPSVEPPLSQETFSDLWKLLPENNVLSPLPSQAMDDLMLSPDDIEQWFTEDPGPDEAPRMPEAAPPVAPAPAAPTPAAPAPAPSWPLSSSVPSQ"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1224
 
1225
+ EXAMPLE_INSULIN = """>sp|P01308|INS_HUMAN Insulin
1226
+ MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN"""
1227
+
1228
+ # Example button handlers
1229
+ def load_egfr():
1230
+ return EXAMPLE_EGFR
1231
+ def load_p53():
1232
+ return EXAMPLE_P53
1233
+ def load_insulin():
1234
+ return EXAMPLE_INSULIN
1235
+
1236
+ example_btn1.click(fn=load_egfr, outputs=[fasta_text])
1237
+ example_btn2.click(fn=load_p53, outputs=[fasta_text])
1238
+ example_btn3.click(fn=load_insulin, outputs=[fasta_text])
 
 
 
 
 
 
 
1239
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1240
  # Export functionality
1241
  export_btn.click(
1242
  fn=export_current_results,
1243
  inputs=[export_format],
1244
  outputs=[export_status, export_download]
1245
  )
1246
+
1247
+ # Main prediction submission
1248
  submit_btn.click(
1249
  fn=lambda fasta, upload, risk_t, risk_v, max_k, use_pv, custom_emb, lookup, metadata, custom_lookup, custom_meta, m_type:
1250
  process_input("", fasta, upload, "fasta_format", risk_t, risk_v, max_k, use_pv, custom_emb, lookup, metadata, custom_lookup, custom_meta, m_type),
 
1257
  ],
1258
  outputs=[results_summary, results_table]
1259
  )
1260
+
1261
  # Database selection event handler
1262
  def update_database_selection(db_choice):
1263
  if db_choice == "UniProt":
 
1281
  gr.update(visible=True),
1282
  gr.update(visible=True),
1283
  )
1284
+
1285
  db_type.change(
1286
  fn=update_database_selection,
1287
  inputs=[db_type],