Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
def audit_check(vendor_name, server_location, model_type):
|
| 4 |
+
# This is simple logic to simulate your "Audit"
|
| 5 |
+
risk_score = 0
|
| 6 |
+
logs = []
|
| 7 |
+
|
| 8 |
+
logs.append(f"🔍 Auditing {vendor_name}...")
|
| 9 |
+
|
| 10 |
+
if server_location == "USA" or server_location == "Unknown":
|
| 11 |
+
risk_score += 50
|
| 12 |
+
logs.append("❌ CRITICAL: Data hosted in US Jurisdiction (Cloud Act Risk).")
|
| 13 |
+
else:
|
| 14 |
+
logs.append("✅ PASS: Data hosted in Safe Jurisdiction.")
|
| 15 |
+
|
| 16 |
+
if model_type == "Public LLM (ChatGPT/Claude)":
|
| 17 |
+
risk_score += 30
|
| 18 |
+
logs.append("⚠️ HIGH: Public Model detected. Zero-Retention Agreement required.")
|
| 19 |
+
else:
|
| 20 |
+
logs.append("✅ PASS: Private/Local Model detected.")
|
| 21 |
+
|
| 22 |
+
if risk_score > 40:
|
| 23 |
+
verdict = "🔴 NO-GO: High Compliance Risk"
|
| 24 |
+
elif risk_score > 20:
|
| 25 |
+
verdict = "🟡 CAUTION: Manual Review Needed"
|
| 26 |
+
else:
|
| 27 |
+
verdict = "🟢 GO: Low Risk / Approved"
|
| 28 |
+
|
| 29 |
+
return verdict, "\n".join(logs)
|
| 30 |
+
|
| 31 |
+
# The Interface
|
| 32 |
+
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 33 |
+
gr.Markdown("# 🛡️ Toro Governance Lab: Vendor Risk Engine")
|
| 34 |
+
gr.Markdown("Instant preliminary risk assessment for Swiss/UK Banking Compliance (nFADP / EU AI Act).")
|
| 35 |
+
|
| 36 |
+
with gr.Row():
|
| 37 |
+
v_name = gr.Textbox(label="Vendor Name")
|
| 38 |
+
loc = gr.Dropdown(["Switzerland", "EU (Germany/France)", "USA", "Unknown"], label="Server Location")
|
| 39 |
+
model = gr.Dropdown(["Private/Local Model", "Public LLM (ChatGPT/Claude)"], label="AI Model Type")
|
| 40 |
+
|
| 41 |
+
btn = gr.Button("Run Audit")
|
| 42 |
+
|
| 43 |
+
out_verdict = gr.Label(label="Audit Verdict")
|
| 44 |
+
out_logs = gr.Textbox(label="Audit Logs")
|
| 45 |
+
|
| 46 |
+
btn.click(audit_check, inputs=[v_name, loc, model], outputs=[out_verdict, out_logs])
|
| 47 |
+
|
| 48 |
+
demo.launch()
|