Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
-
#
|
| 5 |
BRAND_COLORS = {
|
| 6 |
-
'dark_navy': '#081423',
|
| 7 |
-
'navy': '#1F2C6D',
|
| 8 |
-
'light_blue': '#4556E4',
|
| 9 |
-
'yellow': '#FFC700',
|
| 10 |
-
'light_gray': '#ECF0F6'
|
| 11 |
}
|
| 12 |
|
| 13 |
# Default compliance data
|
|
@@ -32,73 +32,88 @@ CUSTOM_CSS = """
|
|
| 32 |
background-color: #081423 !important;
|
| 33 |
}
|
| 34 |
|
| 35 |
-
/* Product selector
|
| 36 |
.product-selector {
|
| 37 |
background-color: #1F2C6D !important;
|
| 38 |
border-radius: 16px !important;
|
| 39 |
-
padding:
|
| 40 |
margin-bottom: 2rem !important;
|
|
|
|
| 41 |
}
|
| 42 |
|
| 43 |
-
|
|
|
|
| 44 |
color: #ECF0F6 !important;
|
| 45 |
-
font-size: 1.
|
| 46 |
-
margin-bottom: 1.5rem !important;
|
| 47 |
font-weight: 600 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
}
|
| 49 |
|
| 50 |
-
/* Radio button styling */
|
| 51 |
.radio-group label {
|
| 52 |
background-color: #081423 !important;
|
|
|
|
| 53 |
border-radius: 8px !important;
|
| 54 |
padding: 0.75rem 1.25rem !important;
|
| 55 |
-
margin
|
| 56 |
color: #ECF0F6 !important;
|
|
|
|
| 57 |
transition: all 0.2s !important;
|
| 58 |
}
|
| 59 |
|
| 60 |
.radio-group label.selected {
|
| 61 |
background-color: #4556E4 !important;
|
| 62 |
-
color:
|
|
|
|
| 63 |
}
|
| 64 |
|
| 65 |
-
/* Input
|
| 66 |
-
.input
|
| 67 |
background-color: #081423 !important;
|
|
|
|
| 68 |
border-radius: 8px !important;
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
}
|
| 72 |
-
|
| 73 |
-
.input-field label {
|
| 74 |
-
color: #4556E4 !important;
|
| 75 |
-
font-weight: 500 !important;
|
| 76 |
-
margin-bottom: 0.5rem !important;
|
| 77 |
}
|
| 78 |
|
| 79 |
/* Recommendation panel */
|
| 80 |
.recommendation-panel {
|
| 81 |
background-color: #FFC700 !important;
|
| 82 |
border-radius: 12px !important;
|
| 83 |
-
padding:
|
| 84 |
-
margin-top:
|
|
|
|
| 85 |
}
|
| 86 |
|
| 87 |
.recommendation-panel h3 {
|
| 88 |
-
|
| 89 |
-
font-size: 1.25rem !important;
|
| 90 |
font-weight: 600 !important;
|
| 91 |
margin-bottom: 1rem !important;
|
|
|
|
| 92 |
}
|
| 93 |
|
| 94 |
.recommendation-panel ul {
|
| 95 |
-
color: #081423 !important;
|
| 96 |
list-style-type: none !important;
|
| 97 |
padding-left: 0 !important;
|
|
|
|
| 98 |
}
|
| 99 |
|
| 100 |
.recommendation-panel li {
|
| 101 |
-
margin-bottom: 0.
|
|
|
|
| 102 |
}
|
| 103 |
|
| 104 |
/* Results section */
|
|
@@ -114,47 +129,35 @@ CUSTOM_CSS = """
|
|
| 114 |
border-radius: 12px !important;
|
| 115 |
padding: 1.5rem !important;
|
| 116 |
color: #081423 !important;
|
|
|
|
| 117 |
}
|
| 118 |
|
| 119 |
-
/*
|
| 120 |
.tab-nav {
|
| 121 |
background-color: #1F2C6D !important;
|
| 122 |
border-radius: 8px 8px 0 0 !important;
|
| 123 |
padding: 0.5rem !important;
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
.tab-nav button {
|
| 127 |
color: #ECF0F6 !important;
|
| 128 |
padding: 0.75rem 1.25rem !important;
|
| 129 |
border-radius: 6px !important;
|
|
|
|
| 130 |
}
|
| 131 |
|
| 132 |
.tab-nav button.selected {
|
| 133 |
background-color: #4556E4 !important;
|
| 134 |
}
|
| 135 |
-
|
| 136 |
-
/* Input label styling */
|
| 137 |
-
.input-label {
|
| 138 |
-
color: #4556E4 !important;
|
| 139 |
-
font-weight: 500 !important;
|
| 140 |
-
margin-bottom: 0.25rem !important;
|
| 141 |
-
}
|
| 142 |
"""
|
| 143 |
|
| 144 |
def recommend_preamble_solution(deployment_type, existing_ai, monthly_budget):
|
| 145 |
-
"""
|
| 146 |
-
Logic for recommending Preamble solution:
|
| 147 |
-
- If on-prem is needed -> Enterprise
|
| 148 |
-
- If no existing AI:
|
| 149 |
-
- If budget > 5000 -> SaaS Platform
|
| 150 |
-
- If budget <= 5000 -> Guardrails
|
| 151 |
-
- If has existing AI -> Recommend Guardrails first
|
| 152 |
-
"""
|
| 153 |
if deployment_type == "On-Premises":
|
| 154 |
return (
|
| 155 |
"Enterprise",
|
| 156 |
"""### 🏢 Enterprise License
|
| 157 |
-
|
| 158 |
- On-premises deployment
|
| 159 |
- Complete compliance controls
|
| 160 |
- Dedicated support team
|
|
@@ -167,7 +170,7 @@ def recommend_preamble_solution(deployment_type, existing_ai, monthly_budget):
|
|
| 167 |
return (
|
| 168 |
"SaaS",
|
| 169 |
"""### 🚀 SaaS Platform
|
| 170 |
-
|
| 171 |
- Full platform features
|
| 172 |
- Quick cloud deployment
|
| 173 |
- Regular updates
|
|
@@ -177,7 +180,7 @@ def recommend_preamble_solution(deployment_type, existing_ai, monthly_budget):
|
|
| 177 |
return (
|
| 178 |
"Guardrails",
|
| 179 |
"""### ⚡ Guardrails
|
| 180 |
-
|
| 181 |
- Basic AI safety controls
|
| 182 |
- API-first implementation
|
| 183 |
- $0.005 per API call
|
|
@@ -187,7 +190,7 @@ def recommend_preamble_solution(deployment_type, existing_ai, monthly_budget):
|
|
| 187 |
return (
|
| 188 |
"Guardrails",
|
| 189 |
"""### ⚡ Guardrails Recommended
|
| 190 |
-
|
| 191 |
- Quick integration with your AI
|
| 192 |
- API-first implementation
|
| 193 |
- $0.005 per API call
|
|
@@ -242,39 +245,44 @@ def create_app():
|
|
| 242 |
with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Default()) as roi_app:
|
| 243 |
# Product Selection Section
|
| 244 |
with gr.Row(elem_classes="product-selector"):
|
| 245 |
-
gr.
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
label="",
|
| 259 |
-
value="Yes, we have existing AI applications",
|
| 260 |
-
elem_classes="radio-group"
|
| 261 |
-
)
|
| 262 |
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
with gr.Column():
|
| 271 |
-
estimated_api_calls = gr.Number(
|
| 272 |
-
label="Estimated Monthly API Calls",
|
| 273 |
-
value=10000,
|
| 274 |
-
elem_classes="input-field"
|
| 275 |
-
)
|
| 276 |
|
| 277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
# Results section
|
| 280 |
with gr.Row(elem_classes="results-container"):
|
|
@@ -288,7 +296,7 @@ def create_app():
|
|
| 288 |
"### 🚀 Using Preamble\n**ROI:** --%\n**Total Costs:** $0",
|
| 289 |
elem_classes="result-card"
|
| 290 |
)
|
| 291 |
-
|
| 292 |
# ROI Calculator tabs
|
| 293 |
with gr.Tabs():
|
| 294 |
with gr.Tab("Organization Details"):
|
|
@@ -354,8 +362,7 @@ def create_app():
|
|
| 354 |
|
| 355 |
calculate_button = gr.Button(
|
| 356 |
"Calculate ROI",
|
| 357 |
-
variant="primary"
|
| 358 |
-
elem_classes="primary-button"
|
| 359 |
)
|
| 360 |
|
| 361 |
def update_results(*inputs):
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
+
# Preamble brand colors - exact hex codes
|
| 5 |
BRAND_COLORS = {
|
| 6 |
+
'dark_navy': '#081423',
|
| 7 |
+
'navy': '#1F2C6D',
|
| 8 |
+
'light_blue': '#4556E4',
|
| 9 |
+
'yellow': '#FFC700',
|
| 10 |
+
'light_gray': '#ECF0F6'
|
| 11 |
}
|
| 12 |
|
| 13 |
# Default compliance data
|
|
|
|
| 32 |
background-color: #081423 !important;
|
| 33 |
}
|
| 34 |
|
| 35 |
+
/* Product selector top section */
|
| 36 |
.product-selector {
|
| 37 |
background-color: #1F2C6D !important;
|
| 38 |
border-radius: 16px !important;
|
| 39 |
+
padding: 2.5rem !important;
|
| 40 |
margin-bottom: 2rem !important;
|
| 41 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
|
| 42 |
}
|
| 43 |
|
| 44 |
+
/* Title styling */
|
| 45 |
+
.selector-title {
|
| 46 |
color: #ECF0F6 !important;
|
| 47 |
+
font-size: 1.75rem !important;
|
|
|
|
| 48 |
font-weight: 600 !important;
|
| 49 |
+
margin-bottom: 2rem !important;
|
| 50 |
+
line-height: 1.2 !important;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/* Section headings */
|
| 54 |
+
.section-label {
|
| 55 |
+
color: #ECF0F6 !important;
|
| 56 |
+
font-size: 1.1rem !important;
|
| 57 |
+
font-weight: 500 !important;
|
| 58 |
+
margin: 1.5rem 0 1rem !important;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/* Radio options styling */
|
| 62 |
+
.radio-group {
|
| 63 |
+
margin-bottom: 1.5rem !important;
|
| 64 |
}
|
| 65 |
|
|
|
|
| 66 |
.radio-group label {
|
| 67 |
background-color: #081423 !important;
|
| 68 |
+
border: 1px solid #4556E4 !important;
|
| 69 |
border-radius: 8px !important;
|
| 70 |
padding: 0.75rem 1.25rem !important;
|
| 71 |
+
margin: 0.5rem 0.75rem 0.5rem 0 !important;
|
| 72 |
color: #ECF0F6 !important;
|
| 73 |
+
font-size: 1rem !important;
|
| 74 |
transition: all 0.2s !important;
|
| 75 |
}
|
| 76 |
|
| 77 |
.radio-group label.selected {
|
| 78 |
background-color: #4556E4 !important;
|
| 79 |
+
border-color: #4556E4 !important;
|
| 80 |
+
color: #ECF0F6 !important;
|
| 81 |
}
|
| 82 |
|
| 83 |
+
/* Input fields */
|
| 84 |
+
.number-input {
|
| 85 |
background-color: #081423 !important;
|
| 86 |
+
border: 1px solid #4556E4 !important;
|
| 87 |
border-radius: 8px !important;
|
| 88 |
+
color: #ECF0F6 !important;
|
| 89 |
+
padding: 0.75rem !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
}
|
| 91 |
|
| 92 |
/* Recommendation panel */
|
| 93 |
.recommendation-panel {
|
| 94 |
background-color: #FFC700 !important;
|
| 95 |
border-radius: 12px !important;
|
| 96 |
+
padding: 2rem !important;
|
| 97 |
+
margin-top: 2rem !important;
|
| 98 |
+
color: #081423 !important;
|
| 99 |
}
|
| 100 |
|
| 101 |
.recommendation-panel h3 {
|
| 102 |
+
font-size: 1.5rem !important;
|
|
|
|
| 103 |
font-weight: 600 !important;
|
| 104 |
margin-bottom: 1rem !important;
|
| 105 |
+
color: #081423 !important;
|
| 106 |
}
|
| 107 |
|
| 108 |
.recommendation-panel ul {
|
|
|
|
| 109 |
list-style-type: none !important;
|
| 110 |
padding-left: 0 !important;
|
| 111 |
+
margin: 1rem 0 !important;
|
| 112 |
}
|
| 113 |
|
| 114 |
.recommendation-panel li {
|
| 115 |
+
margin-bottom: 0.75rem !important;
|
| 116 |
+
font-size: 1.1rem !important;
|
| 117 |
}
|
| 118 |
|
| 119 |
/* Results section */
|
|
|
|
| 129 |
border-radius: 12px !important;
|
| 130 |
padding: 1.5rem !important;
|
| 131 |
color: #081423 !important;
|
| 132 |
+
margin: 0.5rem !important;
|
| 133 |
}
|
| 134 |
|
| 135 |
+
/* Calculator tabs */
|
| 136 |
.tab-nav {
|
| 137 |
background-color: #1F2C6D !important;
|
| 138 |
border-radius: 8px 8px 0 0 !important;
|
| 139 |
padding: 0.5rem !important;
|
| 140 |
+
gap: 0.5rem !important;
|
| 141 |
}
|
| 142 |
|
| 143 |
.tab-nav button {
|
| 144 |
color: #ECF0F6 !important;
|
| 145 |
padding: 0.75rem 1.25rem !important;
|
| 146 |
border-radius: 6px !important;
|
| 147 |
+
margin: 0 0.25rem !important;
|
| 148 |
}
|
| 149 |
|
| 150 |
.tab-nav button.selected {
|
| 151 |
background-color: #4556E4 !important;
|
| 152 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
"""
|
| 154 |
|
| 155 |
def recommend_preamble_solution(deployment_type, existing_ai, monthly_budget):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
if deployment_type == "On-Premises":
|
| 157 |
return (
|
| 158 |
"Enterprise",
|
| 159 |
"""### 🏢 Enterprise License
|
| 160 |
+
Perfect for organizations that need:
|
| 161 |
- On-premises deployment
|
| 162 |
- Complete compliance controls
|
| 163 |
- Dedicated support team
|
|
|
|
| 170 |
return (
|
| 171 |
"SaaS",
|
| 172 |
"""### 🚀 SaaS Platform
|
| 173 |
+
Perfect for teams getting started with AI:
|
| 174 |
- Full platform features
|
| 175 |
- Quick cloud deployment
|
| 176 |
- Regular updates
|
|
|
|
| 180 |
return (
|
| 181 |
"Guardrails",
|
| 182 |
"""### ⚡ Guardrails
|
| 183 |
+
Start with our foundational offering:
|
| 184 |
- Basic AI safety controls
|
| 185 |
- API-first implementation
|
| 186 |
- $0.005 per API call
|
|
|
|
| 190 |
return (
|
| 191 |
"Guardrails",
|
| 192 |
"""### ⚡ Guardrails Recommended
|
| 193 |
+
Perfect for existing AI applications:
|
| 194 |
- Quick integration with your AI
|
| 195 |
- API-first implementation
|
| 196 |
- $0.005 per API call
|
|
|
|
| 245 |
with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Default()) as roi_app:
|
| 246 |
# Product Selection Section
|
| 247 |
with gr.Row(elem_classes="product-selector"):
|
| 248 |
+
with gr.Column():
|
| 249 |
+
gr.Markdown(
|
| 250 |
+
"# Find Your Ideal Preamble Solution",
|
| 251 |
+
elem_classes="selector-title"
|
| 252 |
+
)
|
| 253 |
+
|
| 254 |
+
gr.Markdown("Deployment Preference", elem_classes="section-label")
|
| 255 |
+
deployment_type = gr.Radio(
|
| 256 |
+
["Cloud/SaaS", "On-Premises"],
|
| 257 |
+
label="",
|
| 258 |
+
value="Cloud/SaaS",
|
| 259 |
+
elem_classes="radio-group"
|
| 260 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
|
| 262 |
+
gr.Markdown("AI Implementation Status", elem_classes="section-label")
|
| 263 |
+
existing_ai = gr.Radio(
|
| 264 |
+
["Yes, we have existing AI applications", "No, we need a full platform"],
|
| 265 |
+
label="",
|
| 266 |
+
value="Yes, we have existing AI applications",
|
| 267 |
+
elem_classes="radio-group"
|
| 268 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
|
| 270 |
+
with gr.Row():
|
| 271 |
+
with gr.Column(scale=1):
|
| 272 |
+
monthly_budget = gr.Number(
|
| 273 |
+
label="Monthly Budget ($)",
|
| 274 |
+
value=50000,
|
| 275 |
+
elem_classes="number-input"
|
| 276 |
+
)
|
| 277 |
+
with gr.Column(scale=1):
|
| 278 |
+
estimated_api_calls = gr.Number(
|
| 279 |
+
label="Estimated Monthly API Calls",
|
| 280 |
+
value=10000,
|
| 281 |
+
elem_classes="number-input",
|
| 282 |
+
visible=False
|
| 283 |
+
)
|
| 284 |
+
|
| 285 |
+
recommendation_box = gr.Markdown(elem_classes="recommendation-panel")
|
| 286 |
|
| 287 |
# Results section
|
| 288 |
with gr.Row(elem_classes="results-container"):
|
|
|
|
| 296 |
"### 🚀 Using Preamble\n**ROI:** --%\n**Total Costs:** $0",
|
| 297 |
elem_classes="result-card"
|
| 298 |
)
|
| 299 |
+
|
| 300 |
# ROI Calculator tabs
|
| 301 |
with gr.Tabs():
|
| 302 |
with gr.Tab("Organization Details"):
|
|
|
|
| 362 |
|
| 363 |
calculate_button = gr.Button(
|
| 364 |
"Calculate ROI",
|
| 365 |
+
variant="primary"
|
|
|
|
| 366 |
)
|
| 367 |
|
| 368 |
def update_results(*inputs):
|