Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -14,19 +14,22 @@ import spaces # REQUIRED FOR ZEROGPU
|
|
| 14 |
# ===================================
|
| 15 |
# 1. LOAD AI MODELS (GLOBALLY CACHED)
|
| 16 |
# ===================================
|
| 17 |
-
print("Waking up the Genomic Oracle...
|
| 18 |
|
| 19 |
# A. Kadir's Gatekeeper (Local in the Space)
|
|
|
|
| 20 |
clf_coding = joblib.load("coding_classifier_universal.joblib")
|
| 21 |
|
| 22 |
# B. Base DNABERT (Local in the Space)
|
|
|
|
| 23 |
tokenizer_base = AutoTokenizer.from_pretrained("DNABERT_Local", trust_remote_code=True)
|
| 24 |
-
model_base = AutoModel.from_pretrained("DNABERT_Local", trust_remote_code=True)
|
| 25 |
model_base.eval()
|
| 26 |
|
| 27 |
# C. DNABERT-2 Promoter Model (Local in the Space)
|
|
|
|
| 28 |
tokenizer_promoter = AutoTokenizer.from_pretrained("llm_promoter_classifier_v2", trust_remote_code=True)
|
| 29 |
-
model_promoter = AutoModelForSequenceClassification.from_pretrained("llm_promoter_classifier_v2", trust_remote_code=True)
|
| 30 |
model_promoter.eval()
|
| 31 |
|
| 32 |
# D. Multi-Feature LightGBM (Fetched from Cloud Repo)
|
|
@@ -35,9 +38,9 @@ lgbm_path = hf_hub_download(repo_id="Geonomic/Genomic-Oracle-Weights", filename=
|
|
| 35 |
lightgbm_model = joblib.load(lgbm_path)
|
| 36 |
|
| 37 |
# E. Custom ALiBi Lean/Obese BERT (Fetched from Cloud Repo)
|
| 38 |
-
print("Downloading Phenotype BERT from Model
|
| 39 |
tokenizer_pheno = AutoTokenizer.from_pretrained("Geonomic/Genomic-Oracle-Weights", trust_remote_code=True)
|
| 40 |
-
model_pheno = AutoModelForSequenceClassification.from_pretrained("Geonomic/Genomic-Oracle-Weights", trust_remote_code=True)
|
| 41 |
model_pheno.eval()
|
| 42 |
|
| 43 |
# Structural Feature Dictionary
|
|
@@ -190,7 +193,7 @@ def gradio_inference(dna_sequence, run_mapping):
|
|
| 190 |
f"🎯 **Location:** {context['location']}",
|
| 191 |
f"🧬 **Strand:** {context['strand']}",
|
| 192 |
f"🧭 **Coordinates:** {context['start']:,} – {context['end']:,}",
|
| 193 |
-
f"🔬**Notes:** {context['metadata']}"
|
| 194 |
]
|
| 195 |
context_output = "\n".join(context_lines)
|
| 196 |
else:
|
|
|
|
| 14 |
# ===================================
|
| 15 |
# 1. LOAD AI MODELS (GLOBALLY CACHED)
|
| 16 |
# ===================================
|
| 17 |
+
print("Waking up the Genomic Oracle...\n")
|
| 18 |
|
| 19 |
# A. Kadir's Gatekeeper (Local in the Space)
|
| 20 |
+
print("Loading Logression Model...\n")
|
| 21 |
clf_coding = joblib.load("coding_classifier_universal.joblib")
|
| 22 |
|
| 23 |
# B. Base DNABERT (Local in the Space)
|
| 24 |
+
print("Loading foundational DNABERT Model Architecture...\n")
|
| 25 |
tokenizer_base = AutoTokenizer.from_pretrained("DNABERT_Local", trust_remote_code=True)
|
| 26 |
+
model_base = AutoModel.from_pretrained("DNABERT_Local", trust_remote_code=True, low_cpu_mem_usage=False)
|
| 27 |
model_base.eval()
|
| 28 |
|
| 29 |
# C. DNABERT-2 Promoter Model (Local in the Space)
|
| 30 |
+
print("Loading DNABERT-2 Neural Network...\n")
|
| 31 |
tokenizer_promoter = AutoTokenizer.from_pretrained("llm_promoter_classifier_v2", trust_remote_code=True)
|
| 32 |
+
model_promoter = AutoModelForSequenceClassification.from_pretrained("llm_promoter_classifier_v2", trust_remote_code=True, low_cpu_mem_usage=False)
|
| 33 |
model_promoter.eval()
|
| 34 |
|
| 35 |
# D. Multi-Feature LightGBM (Fetched from Cloud Repo)
|
|
|
|
| 38 |
lightgbm_model = joblib.load(lgbm_path)
|
| 39 |
|
| 40 |
# E. Custom ALiBi Lean/Obese BERT (Fetched from Cloud Repo)
|
| 41 |
+
print("Downloading Phenotype BERT from Model Repository...")
|
| 42 |
tokenizer_pheno = AutoTokenizer.from_pretrained("Geonomic/Genomic-Oracle-Weights", trust_remote_code=True)
|
| 43 |
+
model_pheno = AutoModelForSequenceClassification.from_pretrained("Geonomic/Genomic-Oracle-Weights", trust_remote_code=True, low_cpu_mem_usage=False)
|
| 44 |
model_pheno.eval()
|
| 45 |
|
| 46 |
# Structural Feature Dictionary
|
|
|
|
| 193 |
f"🎯 **Location:** {context['location']}",
|
| 194 |
f"🧬 **Strand:** {context['strand']}",
|
| 195 |
f"🧭 **Coordinates:** {context['start']:,} – {context['end']:,}",
|
| 196 |
+
f"🔬 **Notes:** {context['metadata']}"
|
| 197 |
]
|
| 198 |
context_output = "\n".join(context_lines)
|
| 199 |
else:
|