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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# ============================================================
|
| 5 |
+
# Config (HF Variables fallback-safe)
|
| 6 |
+
# ============================================================
|
| 7 |
+
|
| 8 |
+
PFI_SPACE_URL = os.getenv(
|
| 9 |
+
"PFI_SPACE_URL",
|
| 10 |
+
"https://huggingface.co/spaces/MightHubHumAI/pfi-elite-preview"
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
FINC2E_SPACE_URL = os.getenv(
|
| 14 |
+
"FINC2E_SPACE_URL",
|
| 15 |
+
"https://huggingface.co/spaces/MightHubHumAI/FinC2E-Governance"
|
| 16 |
+
)
|
| 17 |
+
|
| 18 |
+
ENGAGEMENT_EMAIL = os.getenv("ENGAGEMENT_EMAIL", "engagement@bpm.ba")
|
| 19 |
+
GOVERNANCE_EMAIL = os.getenv("GOVERNANCE_EMAIL", "governance@bpm.ba")
|
| 20 |
+
|
| 21 |
+
TITLE = "HumAI MightHub"
|
| 22 |
+
TAGLINE = "Human-Centered AI Systems for Governance, Compliance & Institutional Decision-Making"
|
| 23 |
+
|
| 24 |
+
DISCLAIMER = (
|
| 25 |
+
"This portal provides informational content and controlled previews only. "
|
| 26 |
+
"No financial advice, trading signals, legal advice, or decision execution is provided. "
|
| 27 |
+
"Users remain fully responsible for all decisions made based on external information."
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
LICENSING_TIERS = [
|
| 31 |
+
("Preview", "Open research preview. Limited usage. No personalization. No execution."),
|
| 32 |
+
("Licensed", "Access codes, higher throughput, structured reasoning layers."),
|
| 33 |
+
("Enterprise Pilot", "Policy-bound deployments, audit logs, governance workflows, SLAs."),
|
| 34 |
+
]
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
# ============================================================
|
| 38 |
+
# Helpers
|
| 39 |
+
# ============================================================
|
| 40 |
+
|
| 41 |
+
def mailto(email: str, subject: str) -> str:
|
| 42 |
+
return f"mailto:{email}?subject={subject.replace(' ', '%20')}"
|
| 43 |
+
|
| 44 |
+
def build_access_request(org: str, use_case: str) -> str:
|
| 45 |
+
org = org.strip() or "ORGANIZATION / INDIVIDUAL"
|
| 46 |
+
use_case = use_case.strip() or "USE-CASE DESCRIPTION"
|
| 47 |
+
|
| 48 |
+
return f"""
|
| 49 |
+
ACCESS REQUEST – HumAI MightHub
|
| 50 |
+
|
| 51 |
+
Organization / Individual:
|
| 52 |
+
{org}
|
| 53 |
+
|
| 54 |
+
Use-case description:
|
| 55 |
+
{use_case}
|
| 56 |
+
|
| 57 |
+
Regulatory context:
|
| 58 |
+
(public / internal / confidential / regulated)
|
| 59 |
+
|
| 60 |
+
Desired access tier:
|
| 61 |
+
(Preview / Licensed / Enterprise Pilot)
|
| 62 |
+
|
| 63 |
+
Contact email:
|
| 64 |
+
"""
|
| 65 |
+
|
| 66 |
+
# ============================================================
|
| 67 |
+
# UI
|
| 68 |
+
# ============================================================
|
| 69 |
+
|
| 70 |
+
with gr.Blocks(theme=gr.themes.Soft(), title=TITLE) as demo:
|
| 71 |
+
|
| 72 |
+
gr.Markdown(f"""
|
| 73 |
+
# {TITLE}
|
| 74 |
+
|
| 75 |
+
**{TAGLINE}**
|
| 76 |
+
|
| 77 |
+
**Governance-First — Always.**
|
| 78 |
+
We build AI systems that do not replace responsibility — *they structure it*.
|
| 79 |
+
""")
|
| 80 |
+
|
| 81 |
+
gr.Markdown("### What this is")
|
| 82 |
+
gr.Markdown("""
|
| 83 |
+
- Governance-first AI portal
|
| 84 |
+
- Human-in-the-loop by design
|
| 85 |
+
- Non-executive, non-autonomous systems
|
| 86 |
+
- Audit-ready reasoning interfaces
|
| 87 |
+
""")
|
| 88 |
+
|
| 89 |
+
gr.Markdown("### Available Previews")
|
| 90 |
+
|
| 91 |
+
with gr.Row():
|
| 92 |
+
with gr.Column():
|
| 93 |
+
gr.Markdown("""
|
| 94 |
+
### 🧠 Personal Financial Intelligence (PFI)
|
| 95 |
+
High-density financial reasoning under strict constraints.
|
| 96 |
+
""")
|
| 97 |
+
gr.Button(
|
| 98 |
+
"Open PFI Preview",
|
| 99 |
+
variant="primary"
|
| 100 |
+
).click(
|
| 101 |
+
None,
|
| 102 |
+
js=f"() => window.open('{PFI_SPACE_URL}', '_blank')"
|
| 103 |
+
)
|
| 104 |
+
|
| 105 |
+
with gr.Column():
|
| 106 |
+
gr.Markdown("""
|
| 107 |
+
### 🛡️ FinC2E — Governance Gateway
|
| 108 |
+
Compliance & risk reasoning for regulated environments.
|
| 109 |
+
""")
|
| 110 |
+
gr.Button(
|
| 111 |
+
"Open FinC2E Preview",
|
| 112 |
+
variant="secondary"
|
| 113 |
+
).click(
|
| 114 |
+
None,
|
| 115 |
+
js=f"() => window.open('{FINC2E_SPACE_URL}', '_blank')"
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
gr.Markdown("---")
|
| 119 |
+
gr.Markdown("## Licensing & Access")
|
| 120 |
+
|
| 121 |
+
tier_md = "\n".join([f"- **{name}** — {desc}" for name, desc in LICENSING_TIERS])
|
| 122 |
+
gr.Markdown(tier_md)
|
| 123 |
+
|
| 124 |
+
gr.Markdown("### Request Licensed / Enterprise Access")
|
| 125 |
+
|
| 126 |
+
with gr.Row():
|
| 127 |
+
org_input = gr.Textbox(
|
| 128 |
+
label="Organization / Individual",
|
| 129 |
+
placeholder="e.g. Bank, Fund, Regulator, Enterprise"
|
| 130 |
+
)
|
| 131 |
+
use_case_input = gr.Textbox(
|
| 132 |
+
label="Use-case description",
|
| 133 |
+
lines=3,
|
| 134 |
+
placeholder="e.g. AML triage, portfolio risk framing, audit-ready explanations"
|
| 135 |
+
)
|
| 136 |
+
|
| 137 |
+
template_out = gr.Textbox(
|
| 138 |
+
label="Copy-paste access request",
|
| 139 |
+
lines=10
|
| 140 |
+
)
|
| 141 |
+
|
| 142 |
+
gr.Button("Generate access request template").click(
|
| 143 |
+
build_access_request,
|
| 144 |
+
inputs=[org_input, use_case_input],
|
| 145 |
+
outputs=template_out
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
gr.Markdown("### Contact")
|
| 149 |
+
|
| 150 |
+
with gr.Row():
|
| 151 |
+
gr.Button("Email Engagement").click(
|
| 152 |
+
None,
|
| 153 |
+
js=f"() => window.location.href='{mailto(ENGAGEMENT_EMAIL, 'HumAI Access Request')}'"
|
| 154 |
+
)
|
| 155 |
+
gr.Button("Email Governance").click(
|
| 156 |
+
None,
|
| 157 |
+
js=f"() => window.location.href='{mailto(GOVERNANCE_EMAIL, 'Governance & Compliance Inquiry')}'"
|
| 158 |
+
)
|
| 159 |
+
|
| 160 |
+
gr.Markdown("---")
|
| 161 |
+
gr.Markdown("## Governance & Safety")
|
| 162 |
+
gr.Markdown("""
|
| 163 |
+
- Human-in-the-loop by design
|
| 164 |
+
- No autonomous execution
|
| 165 |
+
- No trading signals or financial advice
|
| 166 |
+
- Policy-bound operation for regulated environments
|
| 167 |
+
""")
|
| 168 |
+
|
| 169 |
+
gr.Markdown(f"**Disclaimer:** {DISCLAIMER}")
|
| 170 |
+
gr.Markdown("© 2026 BPM RED Academy. All rights reserved.")
|
| 171 |
+
|
| 172 |
+
# ============================================================
|
| 173 |
+
# Launch
|
| 174 |
+
# ============================================================
|
| 175 |
+
|
| 176 |
+
if __name__ == "__main__":
|
| 177 |
+
demo.launch()
|