dcata004's picture
Create app.py
c95ced1 verified
import gradio as gr
def audit_regbi(advice_text):
flags = []
score = 100
# REG BI / SEC Keywords
if "fiduciary" not in advice_text.lower():
flags.append("⚠️ Missing 'Fiduciary' Standard acknowledgement.")
score -= 20
if "conflict of interest" not in advice_text.lower() and "disclosure" not in advice_text.lower():
flags.append("🚨 Critical: No Conflict of Interest Disclosure detected.")
score -= 40
if "commission" in advice_text.lower() or "fee" in advice_text.lower():
if "offset" not in advice_text.lower():
flags.append("⚠️ Fee structure mentioned without 'Offset' or 'Net' clarification.")
score -= 15
if score < 60:
verdict = "FAIL: HIGH REGULATORY RISK"
else:
verdict = "PASS: COMPLIANT"
return f"VERDICT: {verdict}\nRISK SCORE: {score}/100\n\nFINDINGS:\n" + "\n".join(flags)
iface = gr.Interface(
fn=audit_regbi,
inputs=gr.Textbox(lines=10, placeholder="Paste Investment Advice / Client Email here..."),
outputs="text",
title="⚖️ WealthGuard RegBI Auditor",
description="Audits client communications for SEC Regulation Best Interest (Reg BI) compliance markers."
)
iface.launch()