Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -52,7 +52,7 @@ def _predict_single(
|
|
| 52 |
"light_seq": light_seq,
|
| 53 |
}
|
| 54 |
progress = gr.Progress(track_tqdm=True)
|
| 55 |
-
progress(0.
|
| 56 |
preds = predict_batch(
|
| 57 |
[record],
|
| 58 |
weights=model_path,
|
|
@@ -60,7 +60,7 @@ def _predict_single(
|
|
| 60 |
backend=backend or None,
|
| 61 |
config=DEFAULT_CONFIG_PATH if DEFAULT_CONFIG_PATH.exists() else None,
|
| 62 |
)
|
| 63 |
-
progress(1.0, "Prediction complete")
|
| 64 |
score = float(preds.iloc[0]["score"])
|
| 65 |
pred = int(preds.iloc[0]["pred"])
|
| 66 |
label = "Polyreactive" if pred == 1 else "Non-polyreactive"
|
|
@@ -134,7 +134,7 @@ def _predict_batch(
|
|
| 134 |
|
| 135 |
records = frame.to_dict("records")
|
| 136 |
progress = gr.Progress(track_tqdm=True)
|
| 137 |
-
progress(0.
|
| 138 |
preds = predict_batch(
|
| 139 |
records,
|
| 140 |
weights=model_path,
|
|
@@ -142,7 +142,7 @@ def _predict_batch(
|
|
| 142 |
backend=backend or None,
|
| 143 |
config=DEFAULT_CONFIG_PATH if DEFAULT_CONFIG_PATH.exists() else None,
|
| 144 |
)
|
| 145 |
-
progress(1.0, "Batch prediction complete")
|
| 146 |
merged = frame.merge(preds, on="id", how="left")
|
| 147 |
output_path = input_path.parent / "polyreact_predictions.csv"
|
| 148 |
merged.to_csv(output_path, index=False)
|
|
@@ -230,14 +230,13 @@ def make_interface() -> gr.Blocks:
|
|
| 230 |
|
| 231 |
gr.Markdown(
|
| 232 |
"""
|
| 233 |
-
|
| 234 |
- Default configuration expects heavy-chain only evaluation.
|
| 235 |
-
- Backend overrides should match how the model was trained to avoid
|
| 236 |
-
feature mismatch.
|
| 237 |
- CSV inputs should include `id`, `heavy_seq`, and optionally `light_seq`.
|
| 238 |
- Add a binary `label` column to compute accuracy/F1/ROC-AUC/PR-AUC/Brier.
|
| 239 |
- Include `reactivity_count` to report Spearman correlation with predicted probabilities.
|
| 240 |
-
-
|
| 241 |
"""
|
| 242 |
)
|
| 243 |
|
|
|
|
| 52 |
"light_seq": light_seq,
|
| 53 |
}
|
| 54 |
progress = gr.Progress(track_tqdm=True)
|
| 55 |
+
progress(0.02, "📦 Downloading ESM-1v weights (first run can take a few minutes)…", total=None)
|
| 56 |
preds = predict_batch(
|
| 57 |
[record],
|
| 58 |
weights=model_path,
|
|
|
|
| 60 |
backend=backend or None,
|
| 61 |
config=DEFAULT_CONFIG_PATH if DEFAULT_CONFIG_PATH.exists() else None,
|
| 62 |
)
|
| 63 |
+
progress(1.0, "✅ Prediction complete")
|
| 64 |
score = float(preds.iloc[0]["score"])
|
| 65 |
pred = int(preds.iloc[0]["pred"])
|
| 66 |
label = "Polyreactive" if pred == 1 else "Non-polyreactive"
|
|
|
|
| 134 |
|
| 135 |
records = frame.to_dict("records")
|
| 136 |
progress = gr.Progress(track_tqdm=True)
|
| 137 |
+
progress(0.02, "📦 Downloading ESM-1v weights (first run can take a few minutes)…", total=None)
|
| 138 |
preds = predict_batch(
|
| 139 |
records,
|
| 140 |
weights=model_path,
|
|
|
|
| 142 |
backend=backend or None,
|
| 143 |
config=DEFAULT_CONFIG_PATH if DEFAULT_CONFIG_PATH.exists() else None,
|
| 144 |
)
|
| 145 |
+
progress(1.0, "✅ Batch prediction complete")
|
| 146 |
merged = frame.merge(preds, on="id", how="left")
|
| 147 |
output_path = input_path.parent / "polyreact_predictions.csv"
|
| 148 |
merged.to_csv(output_path, index=False)
|
|
|
|
| 230 |
|
| 231 |
gr.Markdown(
|
| 232 |
"""
|
| 233 |
+
### Notes
|
| 234 |
- Default configuration expects heavy-chain only evaluation.
|
| 235 |
+
- Backend overrides should match how the model was trained to avoid feature mismatch.
|
|
|
|
| 236 |
- CSV inputs should include `id`, `heavy_seq`, and optionally `light_seq`.
|
| 237 |
- Add a binary `label` column to compute accuracy/F1/ROC-AUC/PR-AUC/Brier.
|
| 238 |
- Include `reactivity_count` to report Spearman correlation with predicted probabilities.
|
| 239 |
+
- **First run downloads the 650M-parameter ESM-1v model; the progress bar will display a download message until it finishes (can take several minutes).**
|
| 240 |
"""
|
| 241 |
)
|
| 242 |
|