updates
Browse files
app.py
CHANGED
|
@@ -745,6 +745,25 @@ async def predict_malware(files: List[UploadFile] = File(...)):
|
|
| 745 |
}
|
| 746 |
|
| 747 |
print(f"\n✅ Prediction complete!\n")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 748 |
|
| 749 |
# === 寫入本地 embeddings_log.jsonl ===
|
| 750 |
log_path = os.path.join("results", "embeddings_log.jsonl")
|
|
|
|
| 745 |
}
|
| 746 |
|
| 747 |
print(f"\n✅ Prediction complete!\n")
|
| 748 |
+
|
| 749 |
+
# === 回傳結果 ===
|
| 750 |
+
# result = {
|
| 751 |
+
# "final_label": final_label,
|
| 752 |
+
# "vote_count": final_count,
|
| 753 |
+
# "total_segments": len(predictions),
|
| 754 |
+
# "confidence": sum(p["confidence"] for p in predictions) / len(predictions),
|
| 755 |
+
# "vote_distribution": dict(vote_counts),
|
| 756 |
+
# "embedding": {
|
| 757 |
+
# "values": best_embedding["embedding"],
|
| 758 |
+
# "source_file": best_embedding["filename"],
|
| 759 |
+
# "attention_score": best_embedding["attention_score"],
|
| 760 |
+
# "dimension": len(best_embedding["embedding"])
|
| 761 |
+
# },
|
| 762 |
+
# "segment_predictions": predictions
|
| 763 |
+
# }
|
| 764 |
+
|
| 765 |
+
# print(f"\n✅ Prediction complete!\n")
|
| 766 |
+
|
| 767 |
|
| 768 |
# === 寫入本地 embeddings_log.jsonl ===
|
| 769 |
log_path = os.path.join("results", "embeddings_log.jsonl")
|