Spaces:
Sleeping
Sleeping
Add vendor and cwe fields to prediction response
Browse files- src/api/main.py +3 -1
- src/api/schemas.py +3 -2
src/api/main.py
CHANGED
|
@@ -94,5 +94,7 @@ def predict(request: CVERequest):
|
|
| 94 |
return PredictionResponse(
|
| 95 |
cve_id=request.cve_id,
|
| 96 |
probability=float(proba),
|
| 97 |
-
prediction=int(proba >= THRESHOLD)
|
|
|
|
|
|
|
| 98 |
)
|
|
|
|
| 94 |
return PredictionResponse(
|
| 95 |
cve_id=request.cve_id,
|
| 96 |
probability=float(proba),
|
| 97 |
+
prediction=int(proba >= THRESHOLD),
|
| 98 |
+
vendor=features.get("vendor"),
|
| 99 |
+
cwe=features.get("cwe"),
|
| 100 |
)
|
src/api/schemas.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
from pydantic import BaseModel
|
| 2 |
-
# Definition of data contracts
|
| 3 |
|
| 4 |
# Just the ID is sufficient, as the API itself handles fetching the data from the NVD
|
| 5 |
class CVERequest(BaseModel):
|
|
@@ -8,4 +7,6 @@ class CVERequest(BaseModel):
|
|
| 8 |
class PredictionResponse(BaseModel):
|
| 9 |
cve_id: str
|
| 10 |
probability: float
|
| 11 |
-
prediction: int
|
|
|
|
|
|
|
|
|
| 1 |
from pydantic import BaseModel
|
|
|
|
| 2 |
|
| 3 |
# Just the ID is sufficient, as the API itself handles fetching the data from the NVD
|
| 4 |
class CVERequest(BaseModel):
|
|
|
|
| 7 |
class PredictionResponse(BaseModel):
|
| 8 |
cve_id: str
|
| 9 |
probability: float
|
| 10 |
+
prediction: int
|
| 11 |
+
vendor: str | None = None
|
| 12 |
+
cwe: str | None = None
|