Geonomic commited on
Commit
2463609
Β·
verified Β·
1 Parent(s): e3348a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
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
- lightgbm_model = joblib.load(lgbm_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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=6)
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("πŸ“ Genomic Context (BLAST/Ensembl)", open=False)
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