Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -240,12 +240,17 @@ def predictmic(sequence):
|
|
| 240 |
|
| 241 |
|
| 242 |
def full_prediction(sequence):
|
|
|
|
| 243 |
features = extract_features(sequence)
|
| 244 |
if isinstance(features, str):
|
|
|
|
| 245 |
return features
|
|
|
|
| 246 |
|
| 247 |
amp_model, _ = get_amp_model()
|
|
|
|
| 248 |
raw_pred = amp_model.predict(features, verbose=0)
|
|
|
|
| 249 |
|
| 250 |
if raw_pred.ndim == 1 or raw_pred.shape[1] == 1:
|
| 251 |
prob_amp = float(raw_pred.flatten()[0]) # sigmoid output assumed = P(AMP)
|
|
@@ -265,7 +270,9 @@ def full_prediction(sequence):
|
|
| 265 |
result = f"Prediction: {amp_result}\nConfidence: {confidence}%\n"
|
| 266 |
|
| 267 |
if prediction == 1:
|
|
|
|
| 268 |
mic_values = predictmic(sequence)
|
|
|
|
| 269 |
result += "\nPredicted MIC Values (μM):\n"
|
| 270 |
for org, mic in mic_values.items():
|
| 271 |
result += f"- {org}: {mic}\n"
|
|
|
|
| 240 |
|
| 241 |
|
| 242 |
def full_prediction(sequence):
|
| 243 |
+
print("[CHECKPOINT] full_prediction called", flush=True)
|
| 244 |
features = extract_features(sequence)
|
| 245 |
if isinstance(features, str):
|
| 246 |
+
print("[CHECKPOINT] extract_features returned error:", features, flush=True)
|
| 247 |
return features
|
| 248 |
+
print("[CHECKPOINT] features extracted OK, shape:", features.shape, flush=True)
|
| 249 |
|
| 250 |
amp_model, _ = get_amp_model()
|
| 251 |
+
print("[CHECKPOINT] AMP model loaded, running predict...", flush=True)
|
| 252 |
raw_pred = amp_model.predict(features, verbose=0)
|
| 253 |
+
print("[CHECKPOINT] AMP predict done:", raw_pred, flush=True)
|
| 254 |
|
| 255 |
if raw_pred.ndim == 1 or raw_pred.shape[1] == 1:
|
| 256 |
prob_amp = float(raw_pred.flatten()[0]) # sigmoid output assumed = P(AMP)
|
|
|
|
| 270 |
result = f"Prediction: {amp_result}\nConfidence: {confidence}%\n"
|
| 271 |
|
| 272 |
if prediction == 1:
|
| 273 |
+
print("[CHECKPOINT] AMP detected, starting MIC (ProtBert)...", flush=True)
|
| 274 |
mic_values = predictmic(sequence)
|
| 275 |
+
print("[CHECKPOINT] MIC done:", mic_values, flush=True)
|
| 276 |
result += "\nPredicted MIC Values (μM):\n"
|
| 277 |
for org, mic in mic_values.items():
|
| 278 |
result += f"- {org}: {mic}\n"
|