Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from typing import Dict, Any
|
| 3 |
+
|
| 4 |
+
app = FastAPI()
|
| 5 |
+
|
| 6 |
+
@app.post("/audit")
|
| 7 |
+
async def audit(bundle: Dict[str, Any]):
|
| 8 |
+
# very simple scoring; replace with your real checks later
|
| 9 |
+
metrics = {
|
| 10 |
+
"TCS": 0.9 if bundle.get("network",{}).get("data") else 0.5,
|
| 11 |
+
"HDI": 1.0,
|
| 12 |
+
"PDS": 0.6,
|
| 13 |
+
"EVI": 3,
|
| 14 |
+
"CBS": 0.2,
|
| 15 |
+
"LQS": 0.6
|
| 16 |
+
}
|
| 17 |
+
decision = "approve" if metrics["CBS"] <= 0.6 else "revise"
|
| 18 |
+
deltas = [] if decision=="approve" else ["Add contrary evidence scan."]
|
| 19 |
+
return {"metrics": metrics, "decision": decision, "deltas": deltas}
|