Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,10 @@ def predict_cwe(commit_message: str):
|
|
36 |
# Map predictions to parent CWE (if available)
|
37 |
mapped_results = {}
|
38 |
for item in sorted_results[:5]:
|
39 |
-
|
|
|
|
|
|
|
40 |
return mapped_results
|
41 |
|
42 |
# Gradio UI
|
|
|
36 |
# Map predictions to parent CWE (if available)
|
37 |
mapped_results = {}
|
38 |
for item in sorted_results[:5]:
|
39 |
+
child_cwe = item["label"].replace("CWE-", "")
|
40 |
+
parent_cwe = child_to_parent.get(child_cwe, child_cwe) # default to child if no parent
|
41 |
+
mapped_results[f"CWE-{parent_cwe}"] = round(float(item["score"]), 4)
|
42 |
+
|
43 |
return mapped_results
|
44 |
|
45 |
# Gradio UI
|