SYS2011's picture
Upload 5 files
89f848a verified
"""
DemandScape Suite — Unified Gradio App
=======================================
Four products, one app, one API key:
📊 DemandScape — Probabilistic demand forecasting across scenarios
🤝 PartnerScape — Partner win-rate, bookings & effectiveness prediction
🎯 DealScape — Opportunity win-rate, pipeline health & SHAP explainability
🛡️ ObjectionScape — Objection classification, severity & deal-outcome prediction
All inference is routed through the fly.dev orchestrator
(FLYIO_ENDPOINT env var). A single DemandScape Suite API key authenticates
every product — no HuggingFace token needed in the front-end.
"""
import os
import gradio as gr
# ── Product modules ──────────────────────────────────────────────────────────
import demandscape
import dealscape
import objectionscape
import partnerscape
# ---------------------------------------------------------------------------
# Configuration
# ---------------------------------------------------------------------------
FLYIO_ENDPOINT = os.getenv(
"FLYIO_ENDPOINT",
"https://demandscape-orchestrator.fly.dev/v1/infer",
)
# ---------------------------------------------------------------------------
# Custom CSS (shared across all tabs)
# ---------------------------------------------------------------------------
custom_css = """
/* ── Suite header ──────────────────────────────────────────────── */
.suite-title {
text-align: center; font-size: 42px; font-weight: bold;
color: #1f77b4; margin-bottom: 6px;
}
.suite-subtitle {
text-align: center; font-size: 20px; color: #555; margin-bottom: 22px;
}
/* ── API-key notice banner ─────────────────────────────────────── */
.api-key-notice {
background: linear-gradient(135deg, #fff3cd, #ffeaa7);
border: 2px solid #f39c12;
border-radius: 10px;
padding: 16px 22px;
margin: 12px 0 16px 0;
font-size: 15px;
text-align: center;
}
/* ── Table header wrapping fix ─────────────────────────────────── */
table thead th {
white-space: normal !important;
height: auto !important;
min-height: 50px !important;
vertical-align: middle !important;
padding: 8px !important;
line-height: 1.4 !important;
}
table td {
white-space: nowrap !important;
padding: 8px !important;
}
"""
# ---------------------------------------------------------------------------
# Build the unified app
# ---------------------------------------------------------------------------
with gr.Blocks(title="DemandScape Suite", css=custom_css) as demo:
# ── Suite header ─────────────────────────────────────────────────────────
with gr.Row():
with gr.Column(scale=1):
gr.Markdown("### Consultant: Diskover Analytics")
gr.Image("Diskover Analytics.png", label="", show_label=False, height=100)
with gr.Column(scale=2):
gr.HTML('<div class="suite-title">DemandScape Suite</div>')
gr.HTML(
'<div class="suite-subtitle">'
"Demand · Partners · Deals · Objections — one platform, one key."
"</div>"
)
with gr.Column(scale=1):
gr.Markdown("### Client: CancerSoft")
gr.Image("CancerSoft Logo.png", label="", show_label=False, height=100)
gr.Markdown("---")
# ── API-key notice ────────────────────────────────────────────────────────
gr.HTML(
'<div class="api-key-notice">'
"🔑 <strong>Demo Access — API Key Required</strong><br/>"
"Request your free demo key by emailing "
'<a href="mailto:info@diskoverdiagnostics.com" style="color:#1f77b4;font-weight:bold;">'
"info@diskoverdiagnostics.com</a>"
"</div>"
)
# ── Shared API key ────────────────────────────────────────────────────────
with gr.Row():
api_key_input = gr.Textbox(
label="🔑 DemandScape Suite API Key",
placeholder="ds_partner_xxxxxxxxx — used by all four products",
type="password",
scale=3,
)
gr.Markdown("---")
# ── Product tabs ──────────────────────────────────────────────────────────
with gr.Tabs():
with gr.Tab("📊 DemandScape"):
demandscape.build_tab(api_key_input, FLYIO_ENDPOINT)
with gr.Tab("🤝 PartnerScape"):
partnerscape.build_tab(api_key_input, FLYIO_ENDPOINT)
with gr.Tab("🎯 DealScape"):
dealscape.build_tab(api_key_input, FLYIO_ENDPOINT)
with gr.Tab("🛡️ ObjectionScape"):
objectionscape.build_tab(api_key_input, FLYIO_ENDPOINT)
# ── Footer ────────────────────────────────────────────────────────────────
gr.Markdown(
"""
---
### 🔍 About DemandScape Suite
| Product | What it does |
|---|---|
| 📊 **DemandScape** | Probabilistic demand forecasts across price, promo, supply & competitor scenarios |
| 🤝 **PartnerScape** | Partner win-rate, bookings value & effectiveness score prediction |
| 🎯 **DealScape** | Opportunity win-rate, expected bookings, pipeline health & SHAP explainability |
| 🛡️ **ObjectionScape** | Objection classification, severity scoring, time-to-close & win/loss prediction |
All products route through the **DemandScape Orchestrator** (`demandscape-orchestrator.fly.dev`)
and are authenticated with a single Partner API Key.
📧 Support: [info@diskoverdiagnostics.com](mailto:info@diskoverdiagnostics.com)
"""
)
# ---------------------------------------------------------------------------
if __name__ == "__main__":
demo.launch(share=False)