Kartik Goyal
updated src/models.py 路 src/environment.py 路 src/generator.py 路 apps/crm_api.py 路 apps/regulatory_api.py 路 apps/audit_api.py
abcf7c3 Download apps/audit_api.py from parth-1/MetaGuard: direct link, hf CLI and curl.
- Browser
- Download file 727 Bytes
-
https://huggingface.co/spaces/parth-1/MetaGuard/resolve/main/apps/audit_api.py
- Command line
-
hf download hf://spaces/parth-1/MetaGuard/apps/audit_api.py
-
curl -L -o audit_api.py https://huggingface.co/spaces/parth-1/MetaGuard/resolve/main/apps/audit_api.py
727 Bytes
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| import uvicorn | |
| import random | |
| import uuid | |
| app = FastAPI(title="Compliance Audit API") | |
| logs = [] | |
| class AuditRecord(BaseModel): | |
| ad_id: str | |
| action_taken: str | |
| reasoning: str | |
| def log_audit(record: AuditRecord): | |
| if random.random() < 0.1: | |
| return {"error": "service_unavailable", "retryable": True} | |
| audit_id = f"AUD-{uuid.uuid4().hex[:8].upper()}" | |
| logs.append({**record.dict(), "audit_id": audit_id}) | |
| return {"status": "logged", "audit_id": audit_id} | |
| def health(): | |
| return {"status": "ok", "service": "compliance-audit"} | |
| if __name__ == "__main__": | |
| uvicorn.run(app, host="0.0.0.0", port=8003) |