Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,7 +33,22 @@ model_promoter.eval()
|
|
| 33 |
|
| 34 |
# D. Multi-Feature LightGBM
|
| 35 |
lgbm_path = hf_hub_download(repo_id="Geonomic/Genomic-Oracle-Weights", filename="dnabert_lightgbm_model_feature_type.pkl")
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# E. Custom Lean/Obese Phenotype BERT (π¨ Forced Native Architecture via Colab Fix!)
|
| 39 |
tokenizer_pheno = BertTokenizer.from_pretrained("Geonomic/Genomic-Oracle-Weights", do_lower_case=False)
|
|
@@ -231,14 +246,14 @@ with gr.Blocks(theme=gr.themes.Soft(), title="𧬠The Genomic Oracle π§¬") as
|
|
| 231 |
|
| 232 |
with gr.Row():
|
| 233 |
with gr.Column(scale=1):
|
| 234 |
-
dna_input = gr.Textbox(label="Enter DNA Sequence", placeholder="e.g., ATGCGATCGATCGATCG...", lines=
|
| 235 |
run_mapping_cb = gr.Checkbox(value=False, label="Query NCBI BLAST for spatial mapping (Takes 1β3 mins)")
|
| 236 |
submit_btn = gr.Button("π Initialize Deep Scan", variant="primary")
|
| 237 |
|
| 238 |
with gr.Column(scale=2):
|
| 239 |
output_summary = gr.Textbox(label="β
Classification Summary", lines=4)
|
| 240 |
stats_panel = gr.Textbox(label="π Internal Pipeline Statistics", lines=4)
|
| 241 |
-
mapping_section = gr.Accordion("
|
| 242 |
with mapping_section:
|
| 243 |
context_output = gr.Textbox(label="Mapping Results", lines=5, placeholder="Results will appear here...")
|
| 244 |
|
|
|
|
| 33 |
|
| 34 |
# D. Multi-Feature LightGBM
|
| 35 |
lgbm_path = hf_hub_download(repo_id="Geonomic/Genomic-Oracle-Weights", filename="dnabert_lightgbm_model_feature_type.pkl")
|
| 36 |
+
raw_lgbm = joblib.load(lgbm_path)
|
| 37 |
+
|
| 38 |
+
# If it's a dictionary, print the keys to the log and try to extract the model
|
| 39 |
+
if isinstance(raw_lgbm, dict):
|
| 40 |
+
print(f"π‘ DEBUG: LightGBM Dictionary Keys: {raw_lgbm.keys()}")
|
| 41 |
+
# We will try the most common names for saved models
|
| 42 |
+
if "model" in raw_lgbm:
|
| 43 |
+
lightgbm_model = raw_lgbm["model"]
|
| 44 |
+
elif "classifier" in raw_lgbm:
|
| 45 |
+
lightgbm_model = raw_lgbm["classifier"]
|
| 46 |
+
else:
|
| 47 |
+
# Fallback: just grab the very first thing in the dictionary
|
| 48 |
+
first_key = list(raw_lgbm.keys())[0]
|
| 49 |
+
lightgbm_model = raw_lgbm[first_key]
|
| 50 |
+
else:
|
| 51 |
+
lightgbm_model = raw_lgbm
|
| 52 |
|
| 53 |
# E. Custom Lean/Obese Phenotype BERT (π¨ Forced Native Architecture via Colab Fix!)
|
| 54 |
tokenizer_pheno = BertTokenizer.from_pretrained("Geonomic/Genomic-Oracle-Weights", do_lower_case=False)
|
|
|
|
| 246 |
|
| 247 |
with gr.Row():
|
| 248 |
with gr.Column(scale=1):
|
| 249 |
+
dna_input = gr.Textbox(label="Enter DNA Sequence", placeholder="e.g., ATGCGATCGATCGATCG...", lines=15)
|
| 250 |
run_mapping_cb = gr.Checkbox(value=False, label="Query NCBI BLAST for spatial mapping (Takes 1β3 mins)")
|
| 251 |
submit_btn = gr.Button("π Initialize Deep Scan", variant="primary")
|
| 252 |
|
| 253 |
with gr.Column(scale=2):
|
| 254 |
output_summary = gr.Textbox(label="β
Classification Summary", lines=4)
|
| 255 |
stats_panel = gr.Textbox(label="π Internal Pipeline Statistics", lines=4)
|
| 256 |
+
mapping_section = gr.Accordion("π Genomic Context (BLAST/Ensembl)", open=False)
|
| 257 |
with mapping_section:
|
| 258 |
context_output = gr.Textbox(label="Mapping Results", lines=5, placeholder="Results will appear here...")
|
| 259 |
|