bpmredacademy's picture
Create app.py
7aeb73a verified
import os
import gradio as gr
# ============================================================
# Config (HF Variables fallback-safe)
# ============================================================
PFI_SPACE_URL = os.getenv(
"PFI_SPACE_URL",
"https://huggingface.co/spaces/MightHubHumAI/pfi-elite-preview"
)
FINC2E_SPACE_URL = os.getenv(
"FINC2E_SPACE_URL",
"https://huggingface.co/spaces/MightHubHumAI/FinC2E-Governance"
)
ENGAGEMENT_EMAIL = os.getenv("ENGAGEMENT_EMAIL", "engagement@bpm.ba")
GOVERNANCE_EMAIL = os.getenv("GOVERNANCE_EMAIL", "governance@bpm.ba")
TITLE = "HumAI MightHub"
TAGLINE = "Human-Centered AI Systems for Governance, Compliance & Institutional Decision-Making"
DISCLAIMER = (
"This portal provides informational content and controlled previews only. "
"No financial advice, trading signals, legal advice, or decision execution is provided. "
"Users remain fully responsible for all decisions made based on external information."
)
LICENSING_TIERS = [
("Preview", "Open research preview. Limited usage. No personalization. No execution."),
("Licensed", "Access codes, higher throughput, structured reasoning layers."),
("Enterprise Pilot", "Policy-bound deployments, audit logs, governance workflows, SLAs."),
]
# ============================================================
# Helpers
# ============================================================
def mailto(email: str, subject: str) -> str:
return f"mailto:{email}?subject={subject.replace(' ', '%20')}"
def build_access_request(org: str, use_case: str) -> str:
org = org.strip() or "ORGANIZATION / INDIVIDUAL"
use_case = use_case.strip() or "USE-CASE DESCRIPTION"
return f"""
ACCESS REQUEST – HumAI MightHub
Organization / Individual:
{org}
Use-case description:
{use_case}
Regulatory context:
(public / internal / confidential / regulated)
Desired access tier:
(Preview / Licensed / Enterprise Pilot)
Contact email:
"""
# ============================================================
# UI
# ============================================================
with gr.Blocks(theme=gr.themes.Soft(), title=TITLE) as demo:
gr.Markdown(f"""
# {TITLE}
**{TAGLINE}**
**Governance-First β€” Always.**
We build AI systems that do not replace responsibility β€” *they structure it*.
""")
gr.Markdown("### What this is")
gr.Markdown("""
- Governance-first AI portal
- Human-in-the-loop by design
- Non-executive, non-autonomous systems
- Audit-ready reasoning interfaces
""")
gr.Markdown("### Available Previews")
with gr.Row():
with gr.Column():
gr.Markdown("""
### 🧠 Personal Financial Intelligence (PFI)
High-density financial reasoning under strict constraints.
""")
gr.Button(
"Open PFI Preview",
variant="primary"
).click(
None,
js=f"() => window.open('{PFI_SPACE_URL}', '_blank')"
)
with gr.Column():
gr.Markdown("""
### πŸ›‘οΈ FinC2E β€” Governance Gateway
Compliance & risk reasoning for regulated environments.
""")
gr.Button(
"Open FinC2E Preview",
variant="secondary"
).click(
None,
js=f"() => window.open('{FINC2E_SPACE_URL}', '_blank')"
)
gr.Markdown("---")
gr.Markdown("## Licensing & Access")
tier_md = "\n".join([f"- **{name}** β€” {desc}" for name, desc in LICENSING_TIERS])
gr.Markdown(tier_md)
gr.Markdown("### Request Licensed / Enterprise Access")
with gr.Row():
org_input = gr.Textbox(
label="Organization / Individual",
placeholder="e.g. Bank, Fund, Regulator, Enterprise"
)
use_case_input = gr.Textbox(
label="Use-case description",
lines=3,
placeholder="e.g. AML triage, portfolio risk framing, audit-ready explanations"
)
template_out = gr.Textbox(
label="Copy-paste access request",
lines=10
)
gr.Button("Generate access request template").click(
build_access_request,
inputs=[org_input, use_case_input],
outputs=template_out
)
gr.Markdown("### Contact")
with gr.Row():
gr.Button("Email Engagement").click(
None,
js=f"() => window.location.href='{mailto(ENGAGEMENT_EMAIL, 'HumAI Access Request')}'"
)
gr.Button("Email Governance").click(
None,
js=f"() => window.location.href='{mailto(GOVERNANCE_EMAIL, 'Governance & Compliance Inquiry')}'"
)
gr.Markdown("---")
gr.Markdown("## Governance & Safety")
gr.Markdown("""
- Human-in-the-loop by design
- No autonomous execution
- No trading signals or financial advice
- Policy-bound operation for regulated environments
""")
gr.Markdown(f"**Disclaimer:** {DISCLAIMER}")
gr.Markdown("Β© 2026 BPM RED Academy. All rights reserved.")
# ============================================================
# Launch
# ============================================================
if __name__ == "__main__":
demo.launch()