Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,522 +1,1459 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
|
|
|
|
|
|
| 3 |
|
| 4 |
-
# Preamble brand colors - exact hex codes
|
| 5 |
BRAND_COLORS = {
|
| 6 |
-
'
|
| 7 |
-
'
|
| 8 |
-
'
|
| 9 |
-
'
|
| 10 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
}
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
| 15 |
-
"
|
| 16 |
-
"
|
| 17 |
-
"
|
| 18 |
-
"FINRA Rule 2210 (Communications)",
|
| 19 |
-
"SEC Rule 17a-4 (Records Retention)",
|
| 20 |
-
"BSA/AML Compliance",
|
| 21 |
-
"Regulation S-ID (Identity Theft Red Flags)"
|
| 22 |
-
],
|
| 23 |
-
"Expected Violations": [1, 1, 1, 1, 1, 1],
|
| 24 |
-
"Penalty": [
|
| 25 |
-
1000000, # SEC Reg S-P: Up to $1M per violation
|
| 26 |
-
100000, # GLBA: Up to $100K per violation
|
| 27 |
-
250000, # FINRA Rule 2210: Up to $250K per violation
|
| 28 |
-
500000, # SEC 17a-4: Up to $500K per violation
|
| 29 |
-
25000, # BSA/AML: $25K per day
|
| 30 |
-
3640, # Reg S-ID: $3,640 per violation (2024 adjusted)
|
| 31 |
],
|
| 32 |
-
"
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
40000, # Communications review
|
| 36 |
-
60000, # Records management
|
| 37 |
-
80000, # AML program review
|
| 38 |
-
35000 # Identity theft program
|
| 39 |
-
]
|
| 40 |
})
|
| 41 |
-
CUSTOM_CSS = """
|
| 42 |
-
.gradio-container {
|
| 43 |
-
max-width: 1200px !important;
|
| 44 |
-
margin: auto !important;
|
| 45 |
-
padding: 2rem !important;
|
| 46 |
-
background-color: #081423 !important;
|
| 47 |
-
font-family: 'Inter', sans-serif !important;
|
| 48 |
-
}
|
| 49 |
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
}
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
|
| 72 |
-
|
| 73 |
-
.section-title {
|
| 74 |
-
color: #ECF0F6 !important;
|
| 75 |
-
font-size: 1.1rem !important;
|
| 76 |
-
font-weight: 500 !important;
|
| 77 |
-
margin: 1.5rem 0 1rem !important;
|
| 78 |
-
}
|
| 79 |
|
| 80 |
-
.radio-container {
|
| 81 |
-
background-color: rgba(8, 20, 35, 0.3) !important;
|
| 82 |
-
border-radius: 12px !important;
|
| 83 |
-
padding: 1rem !important;
|
| 84 |
-
margin-bottom: 1.5rem !important;
|
| 85 |
-
}
|
| 86 |
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
padding: 1rem 1.5rem !important;
|
| 92 |
-
margin: 0.5rem !important;
|
| 93 |
-
color: #ECF0F6 !important;
|
| 94 |
-
transition: all 0.2s !important;
|
| 95 |
-
font-size: 1rem !important;
|
| 96 |
-
}
|
| 97 |
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
| 102 |
|
| 103 |
-
|
| 104 |
-
.
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
-
.number-input {
|
| 112 |
-
background-color: rgba(8, 20, 35, 0.3) !important;
|
| 113 |
-
border: 1px solid rgba(69, 86, 228, 0.5) !important;
|
| 114 |
-
border-radius: 8px !important;
|
| 115 |
-
padding: 1rem !important;
|
| 116 |
-
color: #ECF0F6 !important;
|
| 117 |
-
}
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
|
| 125 |
-
/* Results section */
|
| 126 |
-
.results-container {
|
| 127 |
-
background-color: #4556E4 !important;
|
| 128 |
-
border-radius: 16px !important;
|
| 129 |
-
padding: 2rem !important;
|
| 130 |
-
margin-top: 2rem !important;
|
| 131 |
-
}
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
-
.result-card h3 {
|
| 141 |
-
font-size: 1.5rem !important;
|
| 142 |
-
margin-bottom: 1rem !important;
|
| 143 |
-
color: #081423 !important;
|
| 144 |
-
font-weight: 600 !important;
|
| 145 |
-
}
|
| 146 |
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
}
|
| 151 |
|
| 152 |
-
|
| 153 |
-
.
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
}
|
| 159 |
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
|
| 166 |
-
.tab-nav button {
|
| 167 |
-
color: #ECF0F6 !important;
|
| 168 |
-
padding: 1rem 2rem !important;
|
| 169 |
-
border-radius: 8px 8px 0 0 !important;
|
| 170 |
-
opacity: 0.7 !important;
|
| 171 |
-
}
|
| 172 |
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
-
/* Recommendation panel */
|
| 190 |
-
.recommendation-panel {
|
| 191 |
-
background-color: #FFC700 !important;
|
| 192 |
-
border-radius: 12px !important;
|
| 193 |
-
padding: 2rem !important;
|
| 194 |
-
margin-top: 1.5rem !important;
|
| 195 |
-
}
|
| 196 |
|
| 197 |
-
|
| 198 |
-
color: #081423 !important;
|
| 199 |
-
font-size: 1.5rem !important;
|
| 200 |
-
font-weight: 600 !important;
|
| 201 |
-
margin-bottom: 1rem !important;
|
| 202 |
-
}
|
| 203 |
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
-
|
| 211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
margin-bottom: 0.75rem !important;
|
| 213 |
-
font-
|
| 214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
-
/*
|
| 217 |
-
.
|
| 218 |
-
|
| 219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 220 |
font-weight: 600 !important;
|
| 221 |
padding: 1rem 2rem !important;
|
| 222 |
-
border-radius:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
margin-top: 2rem !important;
|
| 224 |
font-size: 1.1rem !important;
|
| 225 |
-
width:
|
| 226 |
-
transition: all 0.
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 230 |
transform: translateY(-2px) !important;
|
| 231 |
-
box-shadow: 0 4px
|
| 232 |
-
}
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
- Full platform features
|
| 279 |
-
- Quick cloud deployment
|
| 280 |
-
- Regular updates
|
| 281 |
-
- $50 per user/month"""
|
| 282 |
-
)
|
| 283 |
-
|
| 284 |
-
# For budgets $27,000/month and above
|
| 285 |
-
return (
|
| 286 |
-
"Enterprise",
|
| 287 |
-
"""### 🏢 Enterprise License
|
| 288 |
-
Perfect for organizations that need:
|
| 289 |
-
- Full enterprise features
|
| 290 |
-
- Complete compliance controls
|
| 291 |
-
- Dedicated support team
|
| 292 |
-
- Custom integrations
|
| 293 |
-
Starting at $27,000/month"""
|
| 294 |
-
)
|
| 295 |
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
ai_maintenance_cost, ai_security_cost,
|
| 300 |
-
revenue_increase,
|
| 301 |
-
monthly_budget, deployment_type, existing_ai, estimated_api_calls,
|
| 302 |
-
compliance_data] = inputs
|
| 303 |
-
|
| 304 |
-
# Annual labor savings
|
| 305 |
-
total_hours_saved = num_employees * hours_saved_per_week * 52
|
| 306 |
-
labor_cost_savings = total_hours_saved * hourly_wage
|
| 307 |
-
|
| 308 |
-
# Compliance savings - ensure numeric types
|
| 309 |
-
compliance_savings = sum(
|
| 310 |
-
float(row["Expected Violations"]) * (float(row["Penalty"]) + float(row["Attorney Cost"]))
|
| 311 |
-
for _, row in compliance_data.iterrows()
|
| 312 |
-
)
|
| 313 |
-
|
| 314 |
-
# Total benefits
|
| 315 |
-
total_benefits = labor_cost_savings + revenue_increase + compliance_savings
|
| 316 |
-
|
| 317 |
-
# In-house costs
|
| 318 |
-
total_costs_build = (
|
| 319 |
-
initial_platform_cost +
|
| 320 |
-
(num_ai_hires * avg_salary) +
|
| 321 |
-
ai_maintenance_cost +
|
| 322 |
-
ai_security_cost
|
| 323 |
-
)
|
| 324 |
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
total_costs_preamble = 27000 * 12
|
| 329 |
-
elif solution_type == "SaaS":
|
| 330 |
-
total_costs_preamble = num_employees * 50 * 12
|
| 331 |
-
else: # Guardrails
|
| 332 |
-
total_costs_preamble = estimated_api_calls * 0.005 * 12
|
| 333 |
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
|
| 338 |
-
return roi_build, roi_preamble, total_benefits, total_costs_build, total_costs_preamble
|
| 339 |
|
| 340 |
def create_app():
|
| 341 |
with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Default()) as roi_app:
|
|
|
|
|
|
|
|
|
|
| 342 |
with gr.Column(elem_classes="main-container"):
|
| 343 |
-
#
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
elem_classes="
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
elem_classes="
|
| 361 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 362 |
|
| 363 |
with gr.Row(elem_classes="input-row"):
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
|
|
|
|
|
|
|
|
|
| 368 |
)
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
|
|
|
|
|
|
|
|
|
| 374 |
)
|
| 375 |
|
| 376 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 377 |
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
"
|
| 383 |
-
|
|
|
|
|
|
|
|
|
|
| 384 |
)
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
)
|
| 390 |
|
| 391 |
-
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
with gr.Tabs():
|
| 394 |
-
with gr.Tab("
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
)
|
| 400 |
-
hours_saved_per_week = gr.Slider(
|
| 401 |
-
label="Hours Saved per Week per Employee",
|
| 402 |
-
minimum=0, maximum=40, value=6.3,
|
| 403 |
-
info="Estimated time savings per employee"
|
| 404 |
-
)
|
| 405 |
-
hourly_wage = gr.Slider(
|
| 406 |
-
label="Average Hourly Wage ($)",
|
| 407 |
-
minimum=10, maximum=200, value=62,
|
| 408 |
-
info="Average employee compensation"
|
| 409 |
)
|
| 410 |
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 415 |
)
|
| 416 |
-
|
| 417 |
-
num_ai_hires = gr.Number(
|
| 418 |
-
label="Number of AI Personnel",
|
| 419 |
-
value=1
|
| 420 |
-
)
|
| 421 |
-
avg_salary = gr.Number(
|
| 422 |
-
label="Average Annual Salary ($)",
|
| 423 |
-
value=200000
|
| 424 |
-
)
|
| 425 |
-
with gr.Row():
|
| 426 |
-
ai_maintenance_cost = gr.Number(
|
| 427 |
-
label="Annual Maintenance ($)",
|
| 428 |
-
value=500000
|
| 429 |
-
)
|
| 430 |
-
ai_security_cost = gr.Number(
|
| 431 |
-
label="Security & Compliance ($)",
|
| 432 |
-
value=250000
|
| 433 |
-
)
|
| 434 |
-
|
| 435 |
-
with gr.Tab("Compliance"):
|
| 436 |
compliance_data = gr.Dataframe(
|
| 437 |
-
value=
|
| 438 |
-
|
| 439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 440 |
)
|
|
|
|
|
|
|
| 441 |
|
| 442 |
-
with gr.Tab("
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
|
| 446 |
-
|
| 447 |
)
|
|
|
|
|
|
|
| 448 |
|
| 449 |
-
|
|
|
|
|
|
|
|
|
|
| 450 |
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
)
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
# Connect calculate button
|
| 499 |
-
calculate_button.click(
|
| 500 |
-
fn=update_results,
|
| 501 |
-
inputs=[
|
| 502 |
-
num_employees, hours_saved_per_week, hourly_wage,
|
| 503 |
-
initial_platform_cost, num_ai_hires, avg_salary,
|
| 504 |
-
ai_maintenance_cost, ai_security_cost,
|
| 505 |
-
revenue_increase,
|
| 506 |
-
monthly_budget, deployment_type, existing_ai, estimated_api_calls,
|
| 507 |
-
compliance_data
|
| 508 |
-
],
|
| 509 |
-
outputs=[build_roi_box, preamble_roi_box]
|
| 510 |
-
)
|
| 511 |
|
| 512 |
return roi_app
|
| 513 |
|
|
|
|
| 514 |
app = create_app()
|
| 515 |
|
| 516 |
if __name__ == "__main__":
|
| 517 |
app.launch()
|
| 518 |
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
import plotly.graph_objects as go
|
| 5 |
|
|
|
|
| 6 |
BRAND_COLORS = {
|
| 7 |
+
'primary': '#1F2C6D', # Navy
|
| 8 |
+
'secondary': '#081423', # Dark Navy
|
| 9 |
+
'accent': '#FFC700', # Yellow
|
| 10 |
+
'dark_bg': '#081423', # Dark Navy
|
| 11 |
+
'light_bg': '#ECF0F6', # Light Gray
|
| 12 |
+
'button_bg': '#FFC700', # Yellow
|
| 13 |
+
'light_text': '#FFFFFF', # White
|
| 14 |
+
'dark_text': '#081423', # Dark Navy
|
| 15 |
+
'table_header': '#4556E4', # Light Blue
|
| 16 |
+
'table_row_odd': '#FFFFFF', # Pure white
|
| 17 |
+
'table_row_even': '#ECF0F6', # Light Gray
|
| 18 |
+
'label_text': '#000000', # Black for Labels
|
| 19 |
+
'button_text': '#081423', # Dark Navy for Button Text
|
| 20 |
+
'input_text': '#081423', # Dark Navy for Input Text
|
| 21 |
+
'result_header': '#081423', # Dark Navy for Result Headings
|
| 22 |
+
'result_text': '#FFFFFF', # White
|
| 23 |
+
'result_bg': '#081423' # Dark Navy
|
| 24 |
}
|
| 25 |
|
| 26 |
+
default_departments = pd.DataFrame({
|
| 27 |
+
"Department": ["IT", "Finance", "HR", "Marketing", "Sales", "Operations"],
|
| 28 |
+
"Number of Employees": [15, 10, 8, 12, 20, 25],
|
| 29 |
+
"Average Salary": [95000, 85000, 70000, 75000, 85000, 65000],
|
| 30 |
+
"Hours Per Week on Manual Tasks": [20, 15, 12, 10, 8, 18]
|
| 31 |
+
})
|
| 32 |
|
| 33 |
+
default_subscriptions = pd.DataFrame({
|
| 34 |
+
"Tool Category": [
|
| 35 |
+
"CRM", "ERP", "Project Management", "Cloud Storage",
|
| 36 |
+
"SaaS Subscriptions"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
],
|
| 38 |
+
"Current Monthly Cost per User": [80, 150, 30, 25, 45],
|
| 39 |
+
"Number of Users": [90, 90, 90, 90, 90],
|
| 40 |
+
"Estimated Reduction %": [30, 20, 50, 10, 15]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
industry_compliance_data = {
|
| 44 |
+
"Financial Services":
|
| 45 |
+
pd.DataFrame({
|
| 46 |
+
"Regulation": ["GDPR", "CCPA", "SOX", "PCI DSS", "GLBA"],
|
| 47 |
+
"Potential Violations": [2, 1, 1, 3, 2],
|
| 48 |
+
"Penalty": [250000, 150000, 100000, 200000, 175000],
|
| 49 |
+
"Attorney Cost": [50000, 40000, 30000, 45000, 40000]
|
| 50 |
+
}),
|
| 51 |
+
"Healthcare":
|
| 52 |
+
pd.DataFrame({
|
| 53 |
+
"Regulation":
|
| 54 |
+
["HIPAA", "HITECH Act", "GDPR", "CCPA", "Data Protection Act 2018"],
|
| 55 |
+
"Potential Violations": [3, 2, 1, 1, 2],
|
| 56 |
+
"Penalty": [175000, 125000, 100000, 90000, 80000],
|
| 57 |
+
"Attorney Cost": [45000, 35000, 30000, 25000, 20000]
|
| 58 |
+
}),
|
| 59 |
+
"Manufacturing":
|
| 60 |
+
pd.DataFrame({
|
| 61 |
+
"Regulation": [
|
| 62 |
+
"OSHA Regulations", "EPA Regulations", "ISO Standards",
|
| 63 |
+
"NIST Cybersecurity Framework", "GDPR"
|
| 64 |
+
],
|
| 65 |
+
"Potential Violations": [2, 3, 1, 2, 1],
|
| 66 |
+
"Penalty": [75000, 100000, 50000, 150000, 200000],
|
| 67 |
+
"Attorney Cost": [20000, 30000, 15000, 45000, 50000]
|
| 68 |
+
}),
|
| 69 |
+
"Retail":
|
| 70 |
+
pd.DataFrame({
|
| 71 |
+
"Regulation": [
|
| 72 |
+
"PCI DSS", "CCPA", "GDPR", "Consumer Rights Act",
|
| 73 |
+
"Sales Tax Regulations"
|
| 74 |
+
],
|
| 75 |
+
"Potential Violations": [3, 2, 2, 1, 3],
|
| 76 |
+
"Penalty": [100000, 125000, 150000, 50000, 75000],
|
| 77 |
+
"Attorney Cost": [30000, 40000, 50000, 15000, 25000]
|
| 78 |
+
}),
|
| 79 |
+
"Technology":
|
| 80 |
+
pd.DataFrame({
|
| 81 |
+
"Regulation": [
|
| 82 |
+
"GDPR", "CCPA", "COPPA", "Software Licensing Compliance",
|
| 83 |
+
"Export Controls"
|
| 84 |
+
],
|
| 85 |
+
"Potential Violations": [2, 2, 1, 3, 2],
|
| 86 |
+
"Penalty": [200000, 150000, 100000, 175000, 125000],
|
| 87 |
+
"Attorney Cost": [50000, 45000, 30000, 40000, 35000]
|
| 88 |
+
}),
|
| 89 |
+
"Government/Defense":
|
| 90 |
+
pd.DataFrame({
|
| 91 |
+
"Regulation": ["FedRAMP", "CMMC", "NIST SP 800-171", "FISMA", "ITAR"],
|
| 92 |
+
"Potential Violations": [1, 2, 3, 2, 1],
|
| 93 |
+
"Penalty": [250000, 300000, 200000, 150000, 275000],
|
| 94 |
+
"Attorney Cost": [60000, 75000, 50000, 40000, 65000]
|
| 95 |
+
}),
|
| 96 |
+
"Professional Services":
|
| 97 |
+
pd.DataFrame({
|
| 98 |
+
"Regulation": [
|
| 99 |
+
"Client Confidentiality Agreements", "Professional Standards",
|
| 100 |
+
"GDPR", "CCPA", "Ethics Rules"
|
| 101 |
+
],
|
| 102 |
+
"Potential Violations": [2, 1, 1, 1, 3],
|
| 103 |
+
"Penalty": [50000, 100000, 150000, 125000, 75000],
|
| 104 |
+
"Attorney Cost": [20000, 30000, 40000, 35000, 25000]
|
| 105 |
+
}),
|
| 106 |
+
"Energy":
|
| 107 |
+
pd.DataFrame({
|
| 108 |
+
"Regulation": [
|
| 109 |
+
"NERC CIP", "FERC Regulations", "EPA Regulations",
|
| 110 |
+
"State Public Utility Commissions", "Cybersecurity Regulations"
|
| 111 |
+
],
|
| 112 |
+
"Potential Violations": [3, 2, 2, 1, 3],
|
| 113 |
+
"Penalty": [200000, 150000, 175000, 100000, 125000],
|
| 114 |
+
"Attorney Cost": [50000, 40000, 45000, 30000, 35000]
|
| 115 |
+
}),
|
| 116 |
+
"Other":
|
| 117 |
+
pd.DataFrame({
|
| 118 |
+
"Regulation": [
|
| 119 |
+
"Data Privacy", "Financial Reporting",
|
| 120 |
+
"Industry-Specific Requirements", "Records Retention",
|
| 121 |
+
"Security Controls"
|
| 122 |
+
],
|
| 123 |
+
"Potential Violations": [2, 1, 1, 3, 2],
|
| 124 |
+
"Penalty": [250000, 100000, 75000, 50000, 125000],
|
| 125 |
+
"Attorney Cost": [50000, 30000, 25000, 15000, 40000]
|
| 126 |
+
})
|
| 127 |
}
|
| 128 |
|
| 129 |
+
industry_ai_risks = {
|
| 130 |
+
"Financial Services": [
|
| 131 |
+
"Data privacy breaches with sensitive financial information",
|
| 132 |
+
"Algorithmic bias in credit decisions",
|
| 133 |
+
"Compliance violations with regulatory frameworks (e.g., GDPR, CCPA, SOX, PCI DSS, GLBA)"
|
| 134 |
+
],
|
| 135 |
+
"Healthcare": [
|
| 136 |
+
"Patient data confidentiality breaches", "HIPAA compliance violations",
|
| 137 |
+
"Diagnostic errors with clinical decision support",
|
| 138 |
+
"Compliance with HITECH Act, GDPR, CCPA, Data Protection Act 2018"
|
| 139 |
+
],
|
| 140 |
+
"Manufacturing": [
|
| 141 |
+
"Quality control failures from AI systems",
|
| 142 |
+
"Supply chain vulnerability from automated decisions",
|
| 143 |
+
"Safety risks from AI-controlled equipment",
|
| 144 |
+
"Compliance with OSHA, EPA, ISO standards, NIST, GDPR."
|
| 145 |
+
],
|
| 146 |
+
"Retail": [
|
| 147 |
+
"Customer data privacy breaches", "Payment processing vulnerabilities",
|
| 148 |
+
"Biased pricing algorithms",
|
| 149 |
+
"Compliance with PCI DSS, CCPA, GDPR, Consumer Rights Act, Sales Tax regulations."
|
| 150 |
+
],
|
| 151 |
+
"Technology": [
|
| 152 |
+
"Code vulnerabilities in AI-generated software",
|
| 153 |
+
"Intellectual property theft via AI systems",
|
| 154 |
+
"Data leakage through AI pipelines",
|
| 155 |
+
"Compliance with GDPR, CCPA, COPPA, Software Licensing, Export Controls."
|
| 156 |
+
],
|
| 157 |
+
"Government/Defense": [
|
| 158 |
+
"Classified information exposure through AI systems",
|
| 159 |
+
"Supply chain risks in AI components",
|
| 160 |
+
"Compliance violations with FedRAMP, CMMC, NIST, FISMA, ITAR."
|
| 161 |
+
],
|
| 162 |
+
"Professional Services": [
|
| 163 |
+
"Client confidentiality breaches",
|
| 164 |
+
"Legal privilege violations through AI tools",
|
| 165 |
+
"Inaccurate professional advice from AI systems",
|
| 166 |
+
"Compliance with Client Agreements, GDPR, CCPA, and Ethics Rules"
|
| 167 |
+
],
|
| 168 |
+
"Energy": [
|
| 169 |
+
"Critical infrastructure vulnerability",
|
| 170 |
+
"Physical safety risks from automated control systems",
|
| 171 |
+
"Energy supply disruption from AI forecasting errors",
|
| 172 |
+
"Compliance with NERC CIP, FERC and EPA Regulations."
|
| 173 |
+
],
|
| 174 |
+
"Other": [
|
| 175 |
+
"Data privacy and security risks", "Regulatory compliance issues",
|
| 176 |
+
"Intellectual property protection"
|
| 177 |
+
]
|
| 178 |
}
|
| 179 |
|
| 180 |
+
department_use_cases = {
|
| 181 |
+
"IT": [
|
| 182 |
+
"Automated ticket resolution", "Infrastructure optimization",
|
| 183 |
+
"Code generation"
|
| 184 |
+
],
|
| 185 |
+
"Finance":
|
| 186 |
+
["Automated reporting", "Fraud detection", "Invoice processing"],
|
| 187 |
+
"HR": ["Resume screening", "Employee onboarding", "HR analytics"],
|
| 188 |
+
"Marketing":
|
| 189 |
+
["Content generation", "Campaign optimization", "Customer segmentation"],
|
| 190 |
+
"Sales":
|
| 191 |
+
["Lead prioritization", "Sales forecasting", "Automated follow-ups"],
|
| 192 |
+
"Operations":
|
| 193 |
+
["Process automation", "Supply chain optimization", "Quality control"],
|
| 194 |
+
"Legal/Compliance":
|
| 195 |
+
["Contract review", "Regulatory tracking", "Compliance monitoring"],
|
| 196 |
+
"Customer Service":
|
| 197 |
+
["Response generation", "Ticket categorization", "Sentiment analysis"],
|
| 198 |
+
"Research": ["Literature review", "Patent analysis", "Experiment design"],
|
| 199 |
+
"Other": ["Document processing", "Data analysis", "Process automation"]
|
| 200 |
}
|
| 201 |
|
| 202 |
+
# --- Calculation and Recommendation Functions ---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
|
| 205 |
+
def create_subscription_savings_chart(subscription_data):
|
| 206 |
+
categories = subscription_data["Tool Category"].tolist()
|
| 207 |
+
current_costs = []
|
| 208 |
+
savings = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
|
| 210 |
+
for _, row in subscription_data.iterrows():
|
| 211 |
+
monthly_cost = row["Current Monthly Cost per User"] * row[
|
| 212 |
+
"Number of Users"]
|
| 213 |
+
reduction = row["Estimated Reduction %"] / 100
|
| 214 |
+
current_costs.append(monthly_cost)
|
| 215 |
+
savings.append(monthly_cost * reduction)
|
| 216 |
|
| 217 |
+
fig = go.Figure()
|
| 218 |
+
fig.add_trace(
|
| 219 |
+
go.Bar(x=categories,
|
| 220 |
+
y=current_costs,
|
| 221 |
+
name="Current Monthly Cost",
|
| 222 |
+
marker_color=BRAND_COLORS['primary'],
|
| 223 |
+
opacity=0.9))
|
| 224 |
+
fig.add_trace(
|
| 225 |
+
go.Bar(x=categories,
|
| 226 |
+
y=savings,
|
| 227 |
+
name="Potential Monthly Savings",
|
| 228 |
+
marker_color=BRAND_COLORS['accent'],
|
| 229 |
+
opacity=0.9))
|
| 230 |
+
fig.update_layout(
|
| 231 |
+
title="Potential Monthly Subscription Savings with AI",
|
| 232 |
+
barmode='group',
|
| 233 |
+
xaxis_title="Subscription Categories",
|
| 234 |
+
yaxis_title="Cost ($)",
|
| 235 |
+
legend=dict(orientation="h",
|
| 236 |
+
yanchor="bottom",
|
| 237 |
+
y=1.02,
|
| 238 |
+
xanchor="center",
|
| 239 |
+
x=0.5,
|
| 240 |
+
font=dict(color=BRAND_COLORS['light_text'])), # white text
|
| 241 |
+
template="plotly_white",
|
| 242 |
+
font=dict(family="Inter, sans-serif",
|
| 243 |
+
size=12,
|
| 244 |
+
color=BRAND_COLORS['light_text']), # white text
|
| 245 |
+
paper_bgcolor=BRAND_COLORS['dark_bg'],
|
| 246 |
+
plot_bgcolor=BRAND_COLORS['dark_bg'],
|
| 247 |
+
margin=dict(l=40, r=40, t=80, b=40) # black bg
|
| 248 |
+
)
|
| 249 |
+
return fig
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
|
| 252 |
+
def calculate_department_roi(dept_data, hourly_wage_multiplier=1.5):
|
| 253 |
+
results = []
|
| 254 |
+
for _, row in dept_data.iterrows():
|
| 255 |
+
department = row["Department"]
|
| 256 |
+
employees = row["Number of Employees"]
|
| 257 |
+
avg_salary = row["Average Salary"]
|
| 258 |
+
manual_hours = row["Hours Per Week on Manual Tasks"]
|
| 259 |
+
hourly_wage = avg_salary / (52 * 40) * hourly_wage_multiplier
|
| 260 |
+
efficiency_gain = np.random.uniform(0.3, 0.4)
|
| 261 |
+
annual_hours_saved = manual_hours * efficiency_gain * 52 * employees
|
| 262 |
+
annual_savings = annual_hours_saved * hourly_wage
|
| 263 |
+
implementation_cost = avg_salary * 0.2 * employees
|
| 264 |
+
roi = ((annual_savings - implementation_cost) /
|
| 265 |
+
implementation_cost) * 100 if implementation_cost > 0 else 0
|
| 266 |
+
use_cases = department_use_cases.get(
|
| 267 |
+
department,
|
| 268 |
+
department_use_cases.get(
|
| 269 |
+
next((k for k in department_use_cases
|
| 270 |
+
if k.lower() in department.lower()), "Other")))
|
| 271 |
+
results.append({
|
| 272 |
+
"Department": department,
|
| 273 |
+
"Employees": employees,
|
| 274 |
+
"Annual Hours Saved": annual_hours_saved,
|
| 275 |
+
"Annual Cost Savings": annual_savings,
|
| 276 |
+
"Implementation Cost": implementation_cost,
|
| 277 |
+
"ROI": roi,
|
| 278 |
+
"Use Cases": use_cases[:3]
|
| 279 |
+
})
|
| 280 |
+
return sorted(results, key=lambda x: x["ROI"], reverse=True)
|
| 281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
|
| 283 |
+
def calculate_subscription_savings(subscription_data):
|
| 284 |
+
total_current_cost = subscription_data.apply(lambda row: row[
|
| 285 |
+
"Current Monthly Cost per User"] * row["Number of Users"] * 12,
|
| 286 |
+
axis=1).sum()
|
| 287 |
+
total_savings = subscription_data.apply(
|
| 288 |
+
lambda row: row["Current Monthly Cost per User"] * row[
|
| 289 |
+
"Number of Users"] * 12 * row["Estimated Reduction %"] / 100,
|
| 290 |
+
axis=1).sum()
|
| 291 |
+
savings_percentage = (total_savings / total_current_cost
|
| 292 |
+
) * 100 if total_current_cost > 0 else 0
|
| 293 |
+
return {
|
| 294 |
+
"total_current_cost": total_current_cost,
|
| 295 |
+
"total_savings": total_savings,
|
| 296 |
+
"savings_percentage": savings_percentage
|
| 297 |
+
}
|
| 298 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
|
| 300 |
+
def calculate_compliance_savings(compliance_data):
|
| 301 |
+
if compliance_data.empty:
|
| 302 |
+
return {"total_savings": 0, "key_regulations": []}
|
|
|
|
| 303 |
|
| 304 |
+
compliance_data["Potential Violations"] = pd.to_numeric(
|
| 305 |
+
compliance_data["Potential Violations"], errors='coerce').fillna(0)
|
| 306 |
+
compliance_data["Penalty"] = pd.to_numeric(compliance_data["Penalty"],
|
| 307 |
+
errors='coerce').fillna(0)
|
| 308 |
+
compliance_data["Attorney Cost"] = pd.to_numeric(
|
| 309 |
+
compliance_data["Attorney Cost"], errors='coerce').fillna(0)
|
|
|
|
| 310 |
|
| 311 |
+
total_savings = (
|
| 312 |
+
compliance_data["Potential Violations"] *
|
| 313 |
+
(compliance_data["Penalty"] + compliance_data["Attorney Cost"])).sum()
|
| 314 |
+
compliance_data['TotalCost'] = compliance_data["Potential Violations"] * (
|
| 315 |
+
compliance_data["Penalty"] + compliance_data["Attorney Cost"])
|
| 316 |
+
sorted_compliance = compliance_data.sort_values(by='TotalCost',
|
| 317 |
+
ascending=False)
|
| 318 |
+
key_regulations = [{
|
| 319 |
+
"name": row["Regulation"],
|
| 320 |
+
"cost": row["TotalCost"]
|
| 321 |
+
} for _, row in sorted_compliance.head(3).iterrows()]
|
| 322 |
+
return {"total_savings": total_savings, "key_regulations": key_regulations}
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
|
| 325 |
+
def recommend_preamble_solution(industry,
|
| 326 |
+
org_size,
|
| 327 |
+
monthly_budget,
|
| 328 |
+
has_ai_app,
|
| 329 |
+
api_calls=10000):
|
| 330 |
+
"""Recommends Preamble solution with budget and AI app considerations."""
|
| 331 |
+
high_risk_industries = [
|
| 332 |
+
"Financial Services", "Healthcare", "Government/Defense"
|
| 333 |
+
]
|
| 334 |
+
org_size = int(org_size) if org_size is not None else 0
|
| 335 |
+
monthly_budget = float(
|
| 336 |
+
monthly_budget) if monthly_budget is not None else 0.0
|
| 337 |
+
api_calls = int(api_calls) if api_calls is not None else 10000
|
| 338 |
+
shadow_ai_blocker = "[Shadow AI Blocker Chrome Extension](https://chromewebstore.google.com/detail/shadow-ai-blocker/jkcnihggbeejafmbgohlahlighagphon)"
|
| 339 |
|
| 340 |
+
if monthly_budget < 27000:
|
| 341 |
+
if has_ai_app:
|
| 342 |
+
solution = "Guardrails Only"
|
| 343 |
+
monthly_cost = api_calls * 0.005
|
| 344 |
+
description = f"""### ⚡ Guardrails Only
|
| 345 |
+
Perfect for integrating with your existing AI application:
|
| 346 |
+
- Quick API integration.
|
| 347 |
+
- Pre-built security rules.
|
| 348 |
+
- Basic compliance templates.
|
| 349 |
+
- Agentless operation.
|
| 350 |
+
- Free Trial available.
|
| 351 |
+
- {shadow_ai_blocker}
|
| 352 |
+
$0.005 per API call (Est. monthly cost: ${monthly_cost:,.2f} at {api_calls:,} calls/month)"""
|
| 353 |
+
image = "🛡️"
|
| 354 |
+
else:
|
| 355 |
+
solution = "SMB"
|
| 356 |
+
description = f"""### 🚀 SMB
|
| 357 |
+
Perfect for teams getting started with AI:
|
| 358 |
+
- Full platform features.
|
| 359 |
+
- Standard compliance templates.
|
| 360 |
+
- Protection for up to 25 AI applications.
|
| 361 |
+
- Secure Knowledge Base.
|
| 362 |
+
- SaaS Hosting.
|
| 363 |
+
- {shadow_ai_blocker}
|
| 364 |
+
$50 per user/month"""
|
| 365 |
+
image = "🏢"
|
| 366 |
+
elif org_size >= 1000 or industry in high_risk_industries:
|
| 367 |
+
solution = "Enterprise"
|
| 368 |
+
description = f"""### 🏢 Enterprise License
|
| 369 |
+
Perfect for large or high-risk organizations:
|
| 370 |
+
- Complete compliance controls.
|
| 371 |
+
- Custom security model training.
|
| 372 |
+
- Dedicated support team.
|
| 373 |
+
- Unlimited AI system protection.
|
| 374 |
+
- Private cloud/on-premise options.
|
| 375 |
+
- {shadow_ai_blocker}
|
| 376 |
+
Starting at $27,000/month with discounts for multi-year deals"""
|
| 377 |
+
image = "🚀"
|
| 378 |
+
elif org_size >= 100:
|
| 379 |
+
solution = "SMB"
|
| 380 |
+
description = f"""### 🚀 SMB
|
| 381 |
+
Perfect for teams getting started with AI:
|
| 382 |
+
- Full platform features.
|
| 383 |
+
- Standard compliance templates.
|
| 384 |
+
- Protection for up to 25 AI applications.
|
| 385 |
+
- Secure Knowledge Base.
|
| 386 |
+
- SaaS Hosting.
|
| 387 |
+
- {shadow_ai_blocker}
|
| 388 |
+
$50 per user/month"""
|
| 389 |
+
image = "🏢"
|
| 390 |
|
| 391 |
+
else:
|
| 392 |
+
solution = "Guardrails Only"
|
| 393 |
+
monthly_cost = api_calls * 0.005
|
| 394 |
+
description = f"""### ⚡ Guardrails Only
|
| 395 |
+
Perfect for integrating with your existing AI application:
|
| 396 |
+
- Quick API integration.
|
| 397 |
+
- Pre-built security rules.
|
| 398 |
+
- Basic compliance templates.
|
| 399 |
+
- Agentless operation.
|
| 400 |
+
- Free Trial available.
|
| 401 |
+
- {shadow_ai_blocker}
|
| 402 |
+
$0.005 per API call (Est. monthly cost: ${monthly_cost:,.2f} at {api_calls:,} calls/month)"""
|
| 403 |
+
image = "🛡️"
|
| 404 |
+
return {"solution": solution, "description": description, "image": image}
|
| 405 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 406 |
|
| 407 |
+
def calculate_build_vs_buy_comparison(initial_dev_cost=1000000, num_ai_personnel=1, avg_annual_salary=200000, annual_maintenance=500000, security_compliance=250000):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 408 |
|
| 409 |
+
first_year_cost = initial_dev_cost + (num_ai_personnel * avg_annual_salary) + security_compliance
|
| 410 |
+
ongoing_annual_cost = (num_ai_personnel * avg_annual_salary) + annual_maintenance + security_compliance
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
three_year_build_cost = first_year_cost + (ongoing_annual_cost * 2)
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
preamble_annual_cost = 27000 * 12
|
| 417 |
+
three_year_preamble_cost = preamble_annual_cost * 3
|
| 418 |
+
|
| 419 |
+
|
| 420 |
+
three_year_savings = three_year_build_cost - three_year_preamble_cost
|
| 421 |
+
savings_percentage = (three_year_savings / three_year_build_cost) * 100
|
| 422 |
+
|
| 423 |
+
return {
|
| 424 |
+
"first_year_build": first_year_cost,
|
| 425 |
+
"ongoing_annual_build": ongoing_annual_cost,
|
| 426 |
+
"three_year_build": three_year_build_cost,
|
| 427 |
+
"annual_preamble": preamble_annual_cost,
|
| 428 |
+
"three_year_preamble": three_year_preamble_cost,
|
| 429 |
+
"three_year_savings": three_year_savings,
|
| 430 |
+
"savings_percentage": savings_percentage
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
def create_build_vs_buy_chart(comparison_data):
|
| 434 |
+
labels = ["Year 1", "Year 2", "Year 3", "3-Year Total"]
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
build_costs = [
|
| 438 |
+
comparison_data["first_year_build"],
|
| 439 |
+
comparison_data["ongoing_annual_build"],
|
| 440 |
+
comparison_data["ongoing_annual_build"],
|
| 441 |
+
comparison_data["three_year_build"]
|
| 442 |
+
]
|
| 443 |
+
|
| 444 |
+
|
| 445 |
+
preamble_costs = [
|
| 446 |
+
comparison_data["annual_preamble"],
|
| 447 |
+
comparison_data["annual_preamble"],
|
| 448 |
+
comparison_data["annual_preamble"],
|
| 449 |
+
comparison_data["three_year_preamble"]
|
| 450 |
+
]
|
| 451 |
+
|
| 452 |
+
fig = go.Figure()
|
| 453 |
+
|
| 454 |
+
fig.add_trace(go.Bar(
|
| 455 |
+
x=labels,
|
| 456 |
+
y=build_costs,
|
| 457 |
+
name="Build In-House",
|
| 458 |
+
marker_color=BRAND_COLORS['primary'],
|
| 459 |
+
opacity=0.9
|
| 460 |
+
))
|
| 461 |
+
|
| 462 |
+
fig.add_trace(go.Bar(
|
| 463 |
+
x=labels,
|
| 464 |
+
y=preamble_costs,
|
| 465 |
+
name="Preamble Enterprise",
|
| 466 |
+
marker_color=BRAND_COLORS['accent'],
|
| 467 |
+
opacity=0.9
|
| 468 |
+
))
|
| 469 |
+
|
| 470 |
+
fig.update_layout(
|
| 471 |
+
title="Build vs Buy: 3-Year Cost Comparison",
|
| 472 |
+
barmode='group',
|
| 473 |
+
xaxis_title="Timeline",
|
| 474 |
+
yaxis_title="Cost ($)",
|
| 475 |
+
legend=dict(
|
| 476 |
+
orientation="h",
|
| 477 |
+
yanchor="bottom",
|
| 478 |
+
y=1.02,
|
| 479 |
+
xanchor="center",
|
| 480 |
+
x=0.5,
|
| 481 |
+
font=dict(color=BRAND_COLORS['light_text'])
|
| 482 |
+
),
|
| 483 |
+
template="plotly_white",
|
| 484 |
+
font=dict(
|
| 485 |
+
family="Inter, sans-serif",
|
| 486 |
+
size=12,
|
| 487 |
+
color=BRAND_COLORS['light_text']
|
| 488 |
+
),
|
| 489 |
+
paper_bgcolor=BRAND_COLORS['dark_bg'],
|
| 490 |
+
plot_bgcolor=BRAND_COLORS['dark_bg'],
|
| 491 |
+
margin=dict(l=40, r=40, t=80, b=40)
|
| 492 |
+
)
|
| 493 |
+
|
| 494 |
+
return fig
|
| 495 |
+
|
| 496 |
+
def generate_recommendations(industry,
|
| 497 |
+
org_size,
|
| 498 |
+
monthly_budget,
|
| 499 |
+
has_ai_app,
|
| 500 |
+
dept_roi_results,
|
| 501 |
+
subscription_savings,
|
| 502 |
+
compliance_savings,
|
| 503 |
+
api_calls=10000,
|
| 504 |
+
initial_dev_cost=1000000,
|
| 505 |
+
num_ai_personnel=1,
|
| 506 |
+
avg_annual_salary=200000,
|
| 507 |
+
annual_maintenance=500000,
|
| 508 |
+
security_compliance=250000):
|
| 509 |
+
top_departments = dept_roi_results[:3]
|
| 510 |
+
solution_rec = recommend_preamble_solution(industry, org_size,
|
| 511 |
+
monthly_budget, has_ai_app,
|
| 512 |
+
api_calls)
|
| 513 |
+
total_dept_savings = sum(dept["Annual Cost Savings"]
|
| 514 |
+
for dept in dept_roi_results)
|
| 515 |
+
industry_risks = industry_ai_risks.get(industry,
|
| 516 |
+
industry_ai_risks["Other"])
|
| 517 |
|
| 518 |
+
|
| 519 |
+
comparison = calculate_build_vs_buy_comparison(
|
| 520 |
+
initial_dev_cost,
|
| 521 |
+
num_ai_personnel,
|
| 522 |
+
avg_annual_salary,
|
| 523 |
+
annual_maintenance,
|
| 524 |
+
security_compliance
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
+
dept_recommendations = "".join(
|
| 528 |
+
f"\n {i+1}. **{dept['Department']}** (ROI: {dept['ROI']:.1f}%)"
|
| 529 |
+
f"\n - Annual cost savings: ${dept['Annual Cost Savings']:,.2f}"
|
| 530 |
+
f"\n - Hours saved annually: {dept['Annual Hours Saved']:,.0f}"
|
| 531 |
+
f"\n - Top AI use cases:\n - " +
|
| 532 |
+
"\n - ".join(dept["Use Cases"]) + "\n"
|
| 533 |
+
for i, dept in enumerate(top_departments))
|
| 534 |
+
|
| 535 |
+
security_text = "\n\n### Key Security Considerations\n" + "\n".join(
|
| 536 |
+
f"- {risk}" for risk in industry_risks)
|
| 537 |
+
|
| 538 |
+
subscription_text = (
|
| 539 |
+
f"\n### Subscription & Tool Optimization\n- **Current annual spend:** ${subscription_savings['total_current_cost']:,.2f}\n"
|
| 540 |
+
f"- **Potential annual savings:** ${subscription_savings['total_savings']:,.2f} ({subscription_savings['savings_percentage']:.1f}%)\n"
|
| 541 |
+
f"- **Recommendation:** Evaluate consolidation of overlapping tools with AI capabilities\n"
|
| 542 |
+
)
|
| 543 |
+
|
| 544 |
+
compliance_text = (
|
| 545 |
+
f"\n### Compliance Risk Reduction\n- **Potential risk exposure reduction:** ${compliance_savings['total_savings']:,.2f}\n"
|
| 546 |
+
f"- **Key regulations to address:**\n" +
|
| 547 |
+
"".join(f" - {reg['name']}: ${reg['cost']:,.2f} risk exposure\n"
|
| 548 |
+
for reg in compliance_savings['key_regulations']))
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
build_vs_buy_text = (
|
| 552 |
+
f"\n### Build vs Buy Analysis\n"
|
| 553 |
+
f"- **Building in-house:**\n"
|
| 554 |
+
f" - First year cost: ${comparison['first_year_build']:,.2f}\n"
|
| 555 |
+
f" - Ongoing annual cost: ${comparison['ongoing_annual_build']:,.2f}\n"
|
| 556 |
+
f" - 3-year total cost: ${comparison['three_year_build']:,.2f}\n\n"
|
| 557 |
+
f"- **Preamble Enterprise:**\n"
|
| 558 |
+
f" - Annual cost: ${comparison['annual_preamble']:,.2f}\n"
|
| 559 |
+
f" - 3-year total cost: ${comparison['three_year_preamble']:,.2f}\n\n"
|
| 560 |
+
f"- **3-year savings with Preamble:** ${comparison['three_year_savings']:,.2f} ({comparison['savings_percentage']:.1f}%)\n"
|
| 561 |
+
f"- **ROI:** {((comparison['three_year_savings'] / comparison['three_year_preamble']) * 100):,.1f}%\n"
|
| 562 |
+
)
|
| 563 |
+
|
| 564 |
+
report = (
|
| 565 |
+
f"# AI Implementation & Security Recommendation\n## Executive Summary\n"
|
| 566 |
+
f"**Industry:** {industry}\n**Organization Size:** {org_size:,} employees\n"
|
| 567 |
+
f"**Monthly Budget:** ${monthly_budget:,.2f}\n"
|
| 568 |
+
f"**Existing AI Application:** {'Yes' if has_ai_app else 'No'}\n"
|
| 569 |
+
f"**Total Potential Annual Savings:** ${total_dept_savings + subscription_savings['total_savings'] + compliance_savings['total_savings']:,.2f}\n"
|
| 570 |
+
f"### Recommended Preamble Solution\n{solution_rec['image']} {solution_rec['description']}\n"
|
| 571 |
+
f"{build_vs_buy_text}\n"
|
| 572 |
+
f"## Department Recommendations\nThe following departments show the highest potential ROI for AI implementation:\n{dept_recommendations}"
|
| 573 |
+
f"{subscription_text}{compliance_text}{security_text}\n## Implementation Roadmap\n\n"
|
| 574 |
+
f"1. **Phase 1: Security Foundation** (1-2 months)\n"
|
| 575 |
+
f" - Deploy Preamble {solution_rec['solution']}\n"
|
| 576 |
+
f" - Establish AI governance framework\n"
|
| 577 |
+
f" - Train key personnel\n\n"
|
| 578 |
+
f"2. **Phase 2: Department Pilots** (2-3 months)\n"
|
| 579 |
+
f" - Implement AI use cases in {top_departments[0]['Department']}\n"
|
| 580 |
+
f" - Measure results\n\n"
|
| 581 |
+
f"3. **Phase 3: Expansion** (3-6 months)\n"
|
| 582 |
+
f" - Roll out to additional departments\n"
|
| 583 |
+
f" - Begin subscription consolidation\n"
|
| 584 |
+
f" - Scale security controls\n\n"
|
| 585 |
+
f"\n[Learn more about Preamble solutions and pricing](https://preamble.com/pricing)"
|
| 586 |
+
)
|
| 587 |
+
return report, comparison
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
CUSTOM_CSS = f"""
|
| 591 |
+
/* General Styles */
|
| 592 |
+
.gradio-container {{
|
| 593 |
+
max-width: 1200px !important;
|
| 594 |
+
margin: auto !important;
|
| 595 |
+
padding: 2rem !important;
|
| 596 |
+
background-color: {BRAND_COLORS['dark_bg']} !important;
|
| 597 |
+
font-family: 'Inter', sans-serif !important;
|
| 598 |
+
color: {BRAND_COLORS['light_text']} !important;
|
| 599 |
+
border-radius: 12px !important;
|
| 600 |
+
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15) !important;
|
| 601 |
+
font-size: 16px !important;
|
| 602 |
+
}}
|
| 603 |
+
/* Main container */
|
| 604 |
+
.main-container {{
|
| 605 |
+
display: flex !important;
|
| 606 |
+
flex-direction: column !important;
|
| 607 |
+
gap: 2rem !important;
|
| 608 |
+
}}
|
| 609 |
+
/* Section styling */
|
| 610 |
+
.section-container {{
|
| 611 |
+
background-color: {BRAND_COLORS['secondary']} !important;
|
| 612 |
+
border-radius: 12px !important;
|
| 613 |
+
padding: 2.5rem !important;
|
| 614 |
+
margin-bottom: 2rem !important;
|
| 615 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
|
| 616 |
+
border: 1px solid {BRAND_COLORS['primary']} !important;
|
| 617 |
+
transition: all 0.3s ease !important;
|
| 618 |
+
}}
|
| 619 |
+
.section-title {{
|
| 620 |
+
font-size: 2.2rem !important;
|
| 621 |
+
color: {BRAND_COLORS['accent']} !important;
|
| 622 |
+
font-weight: 700 !important;
|
| 623 |
+
margin-bottom: 1.5rem !important;
|
| 624 |
+
line-height: 1.3 !important;
|
| 625 |
+
text-align: center !important;
|
| 626 |
+
text-shadow: 0px 1px 2px rgba(0,0,0,0.2) !important;
|
| 627 |
+
}}
|
| 628 |
+
.subsection-title {{
|
| 629 |
+
color: {BRAND_COLORS['dark_text']} !important;
|
| 630 |
+
font-size: 1.6rem !important;
|
| 631 |
+
font-weight: 600 !important;
|
| 632 |
+
margin: 1.5rem 0 1rem !important;
|
| 633 |
+
border-bottom: 2px solid {BRAND_COLORS['accent']} !important;
|
| 634 |
+
padding-bottom: 0.5rem !important;
|
| 635 |
+
display: inline-block !important;
|
| 636 |
+
}}
|
| 637 |
+
/* Input fields styling */
|
| 638 |
+
.input-row {{
|
| 639 |
+
display: grid !important;
|
| 640 |
+
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
|
| 641 |
+
gap: 1.5rem !important;
|
| 642 |
+
margin: 1.5rem 0 !important;
|
| 643 |
+
}}
|
| 644 |
+
.number-input, .text-input, .dropdown-input, .radio-input {{
|
| 645 |
+
background-color: {BRAND_COLORS['primary']} !important;
|
| 646 |
+
border: 2px solid {BRAND_COLORS['light_bg']} !important;
|
| 647 |
+
border-radius: 10px !important;
|
| 648 |
+
padding: 1rem !important;
|
| 649 |
+
color: {BRAND_COLORS['light_text']} !important;
|
| 650 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
|
| 651 |
+
transition: all 0.2s ease-in-out !important;
|
| 652 |
+
font-size: 16px !important;
|
| 653 |
+
}}
|
| 654 |
+
.number-input:focus, .text-input:focus, .dropdown-input:focus, .radio-input:focus {{
|
| 655 |
+
border-color: {BRAND_COLORS['accent']} !important;
|
| 656 |
+
box-shadow: 0 0 0 4px rgba(255, 199, 0, 0.3) !important;
|
| 657 |
+
outline: none !important;
|
| 658 |
+
transform: translateY(-2px) !important;
|
| 659 |
+
}}
|
| 660 |
+
/* Input Labels - Use the defined label_text color */
|
| 661 |
+
.label-text, .textinput label, .dropdown-input label, .radio-input label, .number-input label {{ color: {BRAND_COLORS['accent']} !important;
|
| 662 |
margin-bottom: 0.75rem !important;
|
| 663 |
+
font-weight: 600 !important;
|
| 664 |
+
font-size: 17px !important;
|
| 665 |
+
display: block !important;
|
| 666 |
+
letter-spacing: 0.5px !important;
|
| 667 |
+
}}
|
| 668 |
+
/* Table/Dataframe styling */
|
| 669 |
+
.table-container {{
|
| 670 |
+
background-color: {BRAND_COLORS['light_bg']} !important;
|
| 671 |
+
border-radius: 10px !important;
|
| 672 |
+
margin: 1.5rem 0 !important;
|
| 673 |
+
overflow: auto !important; /* Changed from 'hidden' to 'auto' to allow scrolling when needed */
|
| 674 |
+
border: 2px solid {BRAND_COLORS['primary']} !important;
|
| 675 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
|
| 676 |
+
max-height: 400px !important; /* Set maximum height */
|
| 677 |
+
}}
|
| 678 |
+
.table-container table {{
|
| 679 |
+
color: {BRAND_COLORS['input_text']} !important;
|
| 680 |
+
width: 100% !important;
|
| 681 |
+
border-collapse: collapse !important;
|
| 682 |
+
font-size: 16px !important;
|
| 683 |
+
display: table !important; /* Ensure proper table display */
|
| 684 |
+
table-layout: fixed !important; /* Fixed layout for better control */
|
| 685 |
+
}}
|
| 686 |
+
.table-container th {{
|
| 687 |
+
background-color: {BRAND_COLORS['table_header']} !important;
|
| 688 |
+
color: #FFFFFF !important;
|
| 689 |
+
padding: 1rem !important;
|
| 690 |
+
text-align: left !important;
|
| 691 |
+
border-bottom: 2px solid {BRAND_COLORS['primary']} !important;
|
| 692 |
+
font-size: 16px !important;
|
| 693 |
+
text-transform: uppercase !important;
|
| 694 |
+
letter-spacing: 0.5px !important;
|
| 695 |
+
}}
|
| 696 |
+
.table-container td {{
|
| 697 |
+
padding: 1rem !important;
|
| 698 |
+
text-align: left !important;
|
| 699 |
+
border-bottom: 1px solid {BRAND_COLORS['table_header']} !important;
|
| 700 |
+
}}
|
| 701 |
+
.table-container tr:nth-child(odd) {{
|
| 702 |
+
background-color: {BRAND_COLORS['table_row_odd']} !important;
|
| 703 |
+
}}
|
| 704 |
+
.table-container tr:nth-child(even) {{
|
| 705 |
+
background-color: {BRAND_COLORS['table_row_even']} !important;
|
| 706 |
+
}}
|
| 707 |
+
.table-container tr:hover {{
|
| 708 |
+
background-color: rgba(255, 199, 0, 0.1) !important;
|
| 709 |
+
}}
|
| 710 |
|
| 711 |
+
/* Department table specific styling */
|
| 712 |
+
.department-table {{
|
| 713 |
+
height: 350px !important;
|
| 714 |
+
min-height: 350px !important;
|
| 715 |
+
overflow-y: visible !important;
|
| 716 |
+
}}
|
| 717 |
+
.department-table table {{
|
| 718 |
+
height: auto !important;
|
| 719 |
+
}}
|
| 720 |
+
.department-table td {{
|
| 721 |
+
white-space: normal !important;
|
| 722 |
+
overflow: visible !important;
|
| 723 |
+
text-overflow: clip !important;
|
| 724 |
+
padding: 12px !important;
|
| 725 |
+
}}
|
| 726 |
+
/* Results container - General background and text */
|
| 727 |
+
.results-container {{
|
| 728 |
+
background-color: {BRAND_COLORS['result_bg']} !important;
|
| 729 |
+
border-radius: 12px !important;
|
| 730 |
+
padding: 2.5rem !important;
|
| 731 |
+
margin-top: 2rem !important;
|
| 732 |
+
color: {BRAND_COLORS['result_text']} !important;
|
| 733 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
|
| 734 |
+
}}
|
| 735 |
+
/* Result Card - Specific overrides */
|
| 736 |
+
.result-card {{
|
| 737 |
+
background-color: {BRAND_COLORS['result_bg']} !important;
|
| 738 |
+
border-radius: 10px !important;
|
| 739 |
+
padding: 2rem !important;
|
| 740 |
+
margin: 1.5rem 0 !important;
|
| 741 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
|
| 742 |
+
font-size: 16px !important;
|
| 743 |
+
color: {BRAND_COLORS['result_text']} !important;
|
| 744 |
+
border-left: 5px solid {BRAND_COLORS['accent']} !important;
|
| 745 |
+
}}
|
| 746 |
+
/* Result Card Headings*/
|
| 747 |
+
.result-card h3 {{
|
| 748 |
+
font-size: 1.8rem !important;
|
| 749 |
+
margin-bottom: 1.2rem !important;
|
| 750 |
+
color: {BRAND_COLORS['result_text']} !important;
|
| 751 |
+
font-weight: 600 !important;
|
| 752 |
+
border-bottom: 2px solid {BRAND_COLORS['accent']} !important;
|
| 753 |
+
padding-bottom: 0.5rem !important;
|
| 754 |
+
}}
|
| 755 |
+
.result-card h4 {{
|
| 756 |
+
font-size: 1.5rem !important;
|
| 757 |
+
margin: 1.2rem 0 0.8rem !important;
|
| 758 |
+
color: {BRAND_COLORS['result_text']} !important;
|
| 759 |
+
font-weight: 600 !important;
|
| 760 |
+
}}
|
| 761 |
+
/* Result card text */
|
| 762 |
+
.result-card p, .result-card strong {{
|
| 763 |
+
color: {BRAND_COLORS['result_text']} !important;
|
| 764 |
+
font-size: 16px !important;
|
| 765 |
+
line-height: 1.7 !important;
|
| 766 |
+
margin-bottom: 1rem !important;
|
| 767 |
+
}}
|
| 768 |
+
.result-card ul {{
|
| 769 |
+
padding-left: 1.5rem !important;
|
| 770 |
+
margin-bottom: 1rem !important;
|
| 771 |
+
}}
|
| 772 |
+
.result-card li {{
|
| 773 |
+
margin-bottom: 0.5rem !important;
|
| 774 |
+
}}
|
| 775 |
+
/* Buttons styling */
|
| 776 |
+
.calculate-button {{
|
| 777 |
+
background-color: {BRAND_COLORS['accent']} !important;
|
| 778 |
+
color: {BRAND_COLORS['button_text']} !important;
|
| 779 |
font-weight: 600 !important;
|
| 780 |
padding: 1rem 2rem !important;
|
| 781 |
+
border-radius: 50px !important;
|
| 782 |
+
margin-top: 2rem !important;
|
| 783 |
+
font-size: 1.2rem !important;
|
| 784 |
+
min-width: 200px !important;
|
| 785 |
+
transition: all 0.3s ease !important;
|
| 786 |
+
display: inline-block !important;
|
| 787 |
+
border: none !important;
|
| 788 |
+
cursor: pointer !important;
|
| 789 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
|
| 790 |
+
text-align: center !important;
|
| 791 |
+
letter-spacing: 0.5px !important;
|
| 792 |
+
}}
|
| 793 |
+
.calculate-button:hover {{
|
| 794 |
+
background-color: #e6b400 !important;
|
| 795 |
+
box-shadow: 0 6px 10px rgba(255, 199, 0, 0.3) !important;
|
| 796 |
+
transform: translateY(-2px) !important;
|
| 797 |
+
}}
|
| 798 |
+
.back-button {{
|
| 799 |
+
background-color: transparent !important;
|
| 800 |
+
color: {BRAND_COLORS['light_text']} !important;
|
| 801 |
+
border: 2px solid {BRAND_COLORS['light_text']} !important;
|
| 802 |
+
font-weight: 600 !important;
|
| 803 |
+
padding: 0.8rem 1.5rem !important;
|
| 804 |
+
border-radius: 50px !important;
|
| 805 |
margin-top: 2rem !important;
|
| 806 |
font-size: 1.1rem !important;
|
| 807 |
+
min-width: 150px !important;
|
| 808 |
+
transition: all 0.3s ease !important;
|
| 809 |
+
display: inline-block !important;
|
| 810 |
+
cursor: pointer !important;
|
| 811 |
+
text-align: center !important;
|
| 812 |
+
}}
|
| 813 |
+
.back-button:hover {{
|
| 814 |
+
background-color: rgba(255, 255, 255, 0.1) !important;
|
| 815 |
+
box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1) !important;
|
| 816 |
+
}}
|
| 817 |
+
/* Button container */
|
| 818 |
+
.button-container {{
|
| 819 |
+
display: flex !important;
|
| 820 |
+
justify-content: space-between !important;
|
| 821 |
+
align-items: center !important;
|
| 822 |
+
margin-top: 2rem !important;
|
| 823 |
+
gap: 1rem !important;
|
| 824 |
+
}}
|
| 825 |
+
.center-button-container {{
|
| 826 |
+
display: flex !important;
|
| 827 |
+
justify-content: center !important;
|
| 828 |
+
align-items: center !important;
|
| 829 |
+
margin-top: 2rem !important;
|
| 830 |
+
gap: 1rem !important;
|
| 831 |
+
}}
|
| 832 |
+
/* Chart container */
|
| 833 |
+
.chart-container {{
|
| 834 |
+
background-color: {BRAND_COLORS['light_bg']} !important;
|
| 835 |
+
border-radius: 12px !important;
|
| 836 |
+
padding: 2rem !important;
|
| 837 |
+
margin: 1.5rem 0 !important;
|
| 838 |
+
height: 500px !important;
|
| 839 |
+
border: 2px solid {BRAND_COLORS['primary']} !important;
|
| 840 |
+
color: {BRAND_COLORS['input_text']} !important;
|
| 841 |
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1) !important;
|
| 842 |
+
}}
|
| 843 |
+
/* Tab styling */
|
| 844 |
+
.tab-nav {{
|
| 845 |
+
padding: 0 !important;
|
| 846 |
+
margin-bottom: 2rem !important;
|
| 847 |
+
display: flex !important;
|
| 848 |
+
justify-content: center !important;
|
| 849 |
+
gap: 0.5rem !important;
|
| 850 |
+
flex-wrap: wrap !important;
|
| 851 |
+
}}
|
| 852 |
+
.tab-nav button {{
|
| 853 |
+
color: {BRAND_COLORS['light_text']} !important;
|
| 854 |
+
padding: 0.8rem 1.8rem !important;
|
| 855 |
+
border-radius: 50px !important;
|
| 856 |
+
opacity: 0.9 !important;
|
| 857 |
+
border: 2px solid {BRAND_COLORS['primary']} !important;
|
| 858 |
+
background-color: {BRAND_COLORS['secondary']} !important;
|
| 859 |
+
cursor: pointer !important;
|
| 860 |
+
font-size: 16px !important;
|
| 861 |
+
font-weight: 600 !important;
|
| 862 |
+
transition: all 0.3s ease !important;
|
| 863 |
+
min-width: 180px !important;
|
| 864 |
+
text-align: center !important;
|
| 865 |
+
}}
|
| 866 |
+
.tab-nav button.selected {{
|
| 867 |
+
background-color: {BRAND_COLORS['primary']} !important;
|
| 868 |
+
color: {BRAND_COLORS['light_text']} !important;
|
| 869 |
+
opacity: 1 !important;
|
| 870 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
|
| 871 |
+
}}
|
| 872 |
+
.tab-nav button:hover {{
|
| 873 |
transform: translateY(-2px) !important;
|
| 874 |
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
|
| 875 |
+
}}
|
| 876 |
+
/* Timeline progress indicator */
|
| 877 |
+
.timeline-container {{
|
| 878 |
+
display: flex !important;
|
| 879 |
+
justify-content: space-between !important;
|
| 880 |
+
align-items: center !important;
|
| 881 |
+
margin: 0 auto 2rem auto !important;
|
| 882 |
+
position: relative !important;
|
| 883 |
+
max-width: 800px !important;
|
| 884 |
+
padding: 15px 20px !important;
|
| 885 |
+
background-color: {BRAND_COLORS['secondary']} !important;
|
| 886 |
+
border-radius: 8px !important;
|
| 887 |
+
}}
|
| 888 |
+
.timeline-container:after {{
|
| 889 |
+
content: "" !important;
|
| 890 |
+
position: absolute !important;
|
| 891 |
+
height: 3px !important;
|
| 892 |
+
background-color: {BRAND_COLORS['primary']} !important;
|
| 893 |
+
top: 50% !important;
|
| 894 |
+
left: 0 !important;
|
| 895 |
+
right: 0 !important;
|
| 896 |
+
z-index: 1 !important;
|
| 897 |
+
}}
|
| 898 |
+
.timeline-step {{
|
| 899 |
+
padding: 8px 15px !important;
|
| 900 |
+
border-radius: 6px !important;
|
| 901 |
+
font-weight: 600 !important;
|
| 902 |
+
font-size: 14px !important;
|
| 903 |
+
color: {BRAND_COLORS['light_text']} !important;
|
| 904 |
+
background-color: {BRAND_COLORS['primary']} !important;
|
| 905 |
+
z-index: 2 !important;
|
| 906 |
+
position: relative !important;
|
| 907 |
+
transition: all 0.3s ease !important;
|
| 908 |
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
|
| 909 |
+
cursor: default !important;
|
| 910 |
+
}}
|
| 911 |
+
.timeline-step.active {{
|
| 912 |
+
background-color: {BRAND_COLORS['accent']} !important;
|
| 913 |
+
color: {BRAND_COLORS['dark_text']} !important;
|
| 914 |
+
transform: translateY(-2px) !important;
|
| 915 |
+
box-shadow: 0 4px 8px rgba(255, 199, 0, 0.3) !important;
|
| 916 |
+
}}
|
| 917 |
+
@media (max-width: 768px) {{
|
| 918 |
+
.timeline-container {{
|
| 919 |
+
flex-direction: column !important;
|
| 920 |
+
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 921 |
|
| 922 |
+
.timeline-container {{
|
| 923 |
+
gap: 10px !important;
|
| 924 |
+
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 925 |
|
| 926 |
+
.timeline-container:after {{
|
| 927 |
+
display: none !important;
|
| 928 |
+
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 929 |
|
| 930 |
+
.timeline-step {{
|
| 931 |
+
width: 100% !important;
|
| 932 |
+
text-align: center !important;
|
| 933 |
+
}}
|
| 934 |
+
}}
|
| 935 |
+
/* Info card */
|
| 936 |
+
.info-card {{
|
| 937 |
+
background-color: rgba(255, 199, 0, 0.1) !important;
|
| 938 |
+
border-left: 4px solid {BRAND_COLORS['accent']} !important;
|
| 939 |
+
padding: 1.2rem !important;
|
| 940 |
+
margin: 1.5rem 0 !important;
|
| 941 |
+
border-radius: 0 8px 8px 0 !important;
|
| 942 |
+
}}
|
| 943 |
+
.info-card-title {{
|
| 944 |
+
font-weight: 600 !important;
|
| 945 |
+
margin-bottom: 0.5rem !important;
|
| 946 |
+
color: {BRAND_COLORS['accent']} !important;
|
| 947 |
+
}}
|
| 948 |
+
.helper-text {{
|
| 949 |
+
color: {BRAND_COLORS['accent']} !important;
|
| 950 |
+
font-size: 14px !important;
|
| 951 |
+
margin-top: 0.5rem !important;
|
| 952 |
+
opacity: 0.9 !important;
|
| 953 |
+
}}
|
| 954 |
+
/* Responsive adjustments */
|
| 955 |
+
@media (max-width: 768px) {{
|
| 956 |
+
.progress-container:after {{
|
| 957 |
+
left: 0 !important;
|
| 958 |
+
right: 0 !important;
|
| 959 |
+
}}
|
| 960 |
+
.section-title {{
|
| 961 |
+
font-size: 1.8rem !important;
|
| 962 |
+
}}
|
| 963 |
+
.subsection-title {{
|
| 964 |
+
font-size: 1.4rem !important;
|
| 965 |
+
}}
|
| 966 |
+
.calculate-button, .back-button {{
|
| 967 |
+
width: 100% !important;
|
| 968 |
+
}}
|
| 969 |
+
}}
|
| 970 |
+
/* Responsive adjustments for smaller screens */
|
| 971 |
+
@media (max-width: 768px) {{
|
| 972 |
+
.input-row {{
|
| 973 |
+
grid-template-columns: 1fr !important; /* Stack inputs vertically */
|
| 974 |
+
}}
|
| 975 |
+
}}
|
| 976 |
+
"""
|
| 977 |
|
|
|
|
| 978 |
|
| 979 |
def create_app():
|
| 980 |
with gr.Blocks(css=CUSTOM_CSS, theme=gr.themes.Default()) as roi_app:
|
| 981 |
+
current_step = gr.State(value=1)
|
| 982 |
+
total_employees_state = gr.State(value=90)
|
| 983 |
+
|
| 984 |
with gr.Column(elem_classes="main-container"):
|
| 985 |
+
gr.Markdown("# Preamble AI Security ROI Calculator",
|
| 986 |
+
elem_classes="section-title")
|
| 987 |
+
with gr.Row(elem_classes="timeline-container"):
|
| 988 |
+
step1_indicator = gr.Markdown(
|
| 989 |
+
"1. Organization Profile",
|
| 990 |
+
elem_classes="timeline-step active",
|
| 991 |
+
elem_id="step1-indicator")
|
| 992 |
+
step2_indicator = gr.Markdown(
|
| 993 |
+
"2. Department Assessment",
|
| 994 |
+
elem_classes="timeline-step",
|
| 995 |
+
elem_id="step2-indicator")
|
| 996 |
+
step3_indicator = gr.Markdown(
|
| 997 |
+
"3. Tools & Compliance",
|
| 998 |
+
elem_classes="timeline-step",
|
| 999 |
+
elem_id="step3-indicator")
|
| 1000 |
+
step4_indicator = gr.Markdown(
|
| 1001 |
+
"4. Results",
|
| 1002 |
+
elem_classes="timeline-step",
|
| 1003 |
+
elem_id="step4-indicator")
|
| 1004 |
+
|
| 1005 |
+
with gr.Column(visible=True,
|
| 1006 |
+
elem_id="step1",
|
| 1007 |
+
elem_classes="section-container") as step1:
|
| 1008 |
+
gr.Markdown("## Organization Profile",
|
| 1009 |
+
elem_classes="section-title")
|
| 1010 |
+
gr.Markdown("""<div class="info-card">
|
| 1011 |
+
<div class="info-card-title">Getting Started</div>
|
| 1012 |
+
Let's understand your organization's needs better. Fill out the basic information below to help us provide tailored recommendations.
|
| 1013 |
+
</div>""")
|
| 1014 |
|
| 1015 |
with gr.Row(elem_classes="input-row"):
|
| 1016 |
+
industry = gr.Dropdown(label="Industry",
|
| 1017 |
+
choices=list(
|
| 1018 |
+
industry_ai_risks.keys()),
|
| 1019 |
+
value="Financial Services",
|
| 1020 |
+
elem_classes="dropdown-input")
|
| 1021 |
+
gr.Markdown(
|
| 1022 |
+
"""<div class="helper-text">Your industry helps us identify specific AI security risks and compliance requirements.</div>"""
|
| 1023 |
)
|
| 1024 |
+
|
| 1025 |
+
with gr.Row(elem_classes="input-row"):
|
| 1026 |
+
org_size = gr.Number(label="Number of Employees",
|
| 1027 |
+
value=90,
|
| 1028 |
+
elem_classes="number-input",
|
| 1029 |
+
precision=0)
|
| 1030 |
+
gr.Markdown(
|
| 1031 |
+
"""<div class="helper-text">This helps us scale recommendations appropriately for your organization size.</div>"""
|
| 1032 |
)
|
| 1033 |
|
| 1034 |
+
with gr.Row(elem_classes="input-row"):
|
| 1035 |
+
monthly_budget = gr.Number(
|
| 1036 |
+
label="Monthly Budget for AI Security ($)",
|
| 1037 |
+
value=30000,
|
| 1038 |
+
elem_classes="number-input",
|
| 1039 |
+
precision=0)
|
| 1040 |
+
gr.Markdown(
|
| 1041 |
+
"""<div class="helper-text">We'll recommend solutions that fit within your budget constraints.</div>"""
|
| 1042 |
+
)
|
| 1043 |
|
| 1044 |
+
with gr.Row(elem_classes="input-row"):
|
| 1045 |
+
has_ai_app = gr.Radio(
|
| 1046 |
+
label=
|
| 1047 |
+
"Do you have an existing in-house AI application?",
|
| 1048 |
+
choices=[("Yes", True), ("No", False)],
|
| 1049 |
+
value=False,
|
| 1050 |
+
elem_classes="radio-input")
|
| 1051 |
+
gr.Markdown(
|
| 1052 |
+
"""<div class="helper-text">This helps determine if we should focus on securing existing AI systems or implementing new ones.</div>"""
|
| 1053 |
)
|
| 1054 |
+
|
| 1055 |
+
with gr.Row(elem_classes="input-row"):
|
| 1056 |
+
api_calls = gr.Number(label="Estimated Monthly API Calls",
|
| 1057 |
+
value=10000,
|
| 1058 |
+
elem_classes="number-input",
|
| 1059 |
+
precision=0)
|
| 1060 |
+
gr.Markdown(
|
| 1061 |
+
"""<div class="helper-text">For organizations with existing AI systems, this helps estimate the cost of our Guardrails solution (based on 8hr workday, 5 days/week).</div>"""
|
| 1062 |
)
|
| 1063 |
|
| 1064 |
+
with gr.Row(elem_classes="button-container"):
|
| 1065 |
+
next_button1 = gr.Button("Next: Department Assessment →",
|
| 1066 |
+
elem_classes="calculate-button")
|
| 1067 |
+
|
| 1068 |
+
|
| 1069 |
+
with gr.Column(visible=False,
|
| 1070 |
+
elem_id="step2",
|
| 1071 |
+
elem_classes="section-container") as step2:
|
| 1072 |
+
gr.Markdown("## Department Assessment",
|
| 1073 |
+
elem_classes="section-title")
|
| 1074 |
+
gr.Markdown("""<div class="info-card">
|
| 1075 |
+
<div class="info-card-title">Department Breakdown</div>
|
| 1076 |
+
Review and customize the department data below to match your organization's structure. This helps us identify which departments will benefit most from AI implementation.
|
| 1077 |
+
</div>""")
|
| 1078 |
+
|
| 1079 |
+
gr.Markdown(
|
| 1080 |
+
"#### Edit the table below to match your organization",
|
| 1081 |
+
elem_classes="subsection-title")
|
| 1082 |
+
department_data = gr.Dataframe(
|
| 1083 |
+
value=default_departments,
|
| 1084 |
+
headers=[
|
| 1085 |
+
"Department", "Number of Employees", "Average Salary",
|
| 1086 |
+
"Hours Per Week on Manual Tasks"
|
| 1087 |
+
],
|
| 1088 |
+
datatype=["str", "number", "number", "number"],
|
| 1089 |
+
col_count=(4, "fixed"),
|
| 1090 |
+
elem_classes="table-container department-table",
|
| 1091 |
+
interactive=True)
|
| 1092 |
+
|
| 1093 |
+
gr.Markdown("""<div class="helper-text">
|
| 1094 |
+
✓ Add or modify departments as needed<br>
|
| 1095 |
+
✓ Update employee counts to reflect your team structure<br>
|
| 1096 |
+
✓ Estimate time spent on tasks that could be automated with AI
|
| 1097 |
+
</div>""")
|
| 1098 |
+
|
| 1099 |
+
with gr.Row(elem_classes="button-container"):
|
| 1100 |
+
back_button2 = gr.Button("← Back",
|
| 1101 |
+
elem_classes="back-button")
|
| 1102 |
+
next_button2 = gr.Button("Next: Tools & Compliance →",
|
| 1103 |
+
elem_classes="calculate-button")
|
| 1104 |
+
|
| 1105 |
+
|
| 1106 |
+
with gr.Column(visible=False,
|
| 1107 |
+
elem_id="step3",
|
| 1108 |
+
elem_classes="section-container") as step3:
|
| 1109 |
+
gr.Markdown("## Tools & Compliance",
|
| 1110 |
+
elem_classes="section-title")
|
| 1111 |
+
|
| 1112 |
+
gr.Markdown("""<div class="info-card">
|
| 1113 |
+
<div class="info-card-title">Optimize Costs & Reduce Risk</div>
|
| 1114 |
+
In this section, we'll identify potential savings from consolidating tools with AI capabilities and estimate compliance risk reduction based on your industry.
|
| 1115 |
+
</div>""")
|
| 1116 |
+
|
| 1117 |
with gr.Tabs():
|
| 1118 |
+
with gr.Tab("Technology & Subscriptions"):
|
| 1119 |
+
gr.Markdown("#### Current Software & Tools",
|
| 1120 |
+
elem_classes="subsection-title")
|
| 1121 |
+
gr.Markdown(
|
| 1122 |
+
"""Review and edit your current technology expenses that could be optimized with AI solutions."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1123 |
)
|
| 1124 |
|
| 1125 |
+
subscription_data = gr.Dataframe(
|
| 1126 |
+
value=default_subscriptions,
|
| 1127 |
+
headers=[
|
| 1128 |
+
"Tool Category",
|
| 1129 |
+
"Current Monthly Cost per User",
|
| 1130 |
+
"Number of Users", "Estimated Reduction %"
|
| 1131 |
+
],
|
| 1132 |
+
datatype=["str", "number", "number", "number"],
|
| 1133 |
+
col_count=(4, "fixed"),
|
| 1134 |
+
elem_classes="table-container",
|
| 1135 |
+
interactive=True)
|
| 1136 |
+
|
| 1137 |
+
gr.Markdown("""<div class="helper-text">
|
| 1138 |
+
Adjust the "Estimated Reduction %" to reflect how much you believe AI could help reduce costs in each category.
|
| 1139 |
+
</div>""")
|
| 1140 |
+
|
| 1141 |
+
with gr.Tab("Compliance & Risk"):
|
| 1142 |
+
gr.Markdown("#### Regulatory Requirements",
|
| 1143 |
+
elem_classes="subsection-title")
|
| 1144 |
+
gr.Markdown(
|
| 1145 |
+
"""These compliance requirements are tailored to your industry. Edit to match your specific situation."""
|
| 1146 |
)
|
| 1147 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1148 |
compliance_data = gr.Dataframe(
|
| 1149 |
+
value=industry_compliance_data[
|
| 1150 |
+
"Financial Services"],
|
| 1151 |
+
headers=[
|
| 1152 |
+
"Regulation", "Potential Violations",
|
| 1153 |
+
"Penalty", "Attorney Cost"
|
| 1154 |
+
],
|
| 1155 |
+
datatype=["str", "number", "number", "number"],
|
| 1156 |
+
col_count=(4, "fixed"),
|
| 1157 |
+
elem_classes="table-container",
|
| 1158 |
+
interactive=True)
|
| 1159 |
+
|
| 1160 |
+
gr.Markdown("""<div class="helper-text">
|
| 1161 |
+
✓ "Potential Violations" estimates how many compliance issues AI security could prevent<br>
|
| 1162 |
+
✓ "Penalty" represents average regulatory fines per violation<br>
|
| 1163 |
+
✓ "Attorney Cost" includes legal expenses for addressing violations
|
| 1164 |
+
</div>""")
|
| 1165 |
+
|
| 1166 |
+
with gr.Row(elem_classes="button-container"):
|
| 1167 |
+
back_button3 = gr.Button("← Back",
|
| 1168 |
+
elem_classes="back-button")
|
| 1169 |
+
next_button3 = gr.Button("Next: Build vs Buy Comparison →",
|
| 1170 |
+
elem_classes="calculate-button")
|
| 1171 |
+
calculate_button = gr.Button(
|
| 1172 |
+
"Generate Recommendations ✨",
|
| 1173 |
+
elem_classes="calculate-button")
|
| 1174 |
+
|
| 1175 |
+
|
| 1176 |
+
with gr.Column(visible=False,
|
| 1177 |
+
elem_id="step3_5",
|
| 1178 |
+
elem_classes="section-container") as step3_5:
|
| 1179 |
+
gr.Markdown("## Build vs Buy Analysis",
|
| 1180 |
+
elem_classes="section-title")
|
| 1181 |
+
|
| 1182 |
+
gr.Markdown("""<div class="info-card">
|
| 1183 |
+
<div class="info-card-title">Compare Building In-House vs Preamble</div>
|
| 1184 |
+
Adjust the values below to compare the cost of building and maintaining your own AI security platform versus using Preamble's enterprise solution.
|
| 1185 |
+
</div>""")
|
| 1186 |
+
|
| 1187 |
+
with gr.Row(elem_classes="input-row"):
|
| 1188 |
+
initial_dev_cost = gr.Number(
|
| 1189 |
+
label="Initial Development Cost ($)",
|
| 1190 |
+
value=1000000,
|
| 1191 |
+
elem_classes="number-input",
|
| 1192 |
+
precision=0)
|
| 1193 |
+
|
| 1194 |
+
with gr.Row(elem_classes="input-row"):
|
| 1195 |
+
num_ai_personnel = gr.Number(
|
| 1196 |
+
label="Number of AI Personnel",
|
| 1197 |
+
value=1,
|
| 1198 |
+
elem_classes="number-input",
|
| 1199 |
+
precision=0)
|
| 1200 |
+
avg_annual_salary = gr.Number(
|
| 1201 |
+
label="Average Annual Salary ($)",
|
| 1202 |
+
value=200000,
|
| 1203 |
+
elem_classes="number-input",
|
| 1204 |
+
precision=0)
|
| 1205 |
+
|
| 1206 |
+
with gr.Row(elem_classes="input-row"):
|
| 1207 |
+
annual_maintenance = gr.Number(
|
| 1208 |
+
label="Annual Maintenance ($)",
|
| 1209 |
+
value=500000,
|
| 1210 |
+
elem_classes="number-input",
|
| 1211 |
+
precision=0)
|
| 1212 |
+
security_compliance = gr.Number(
|
| 1213 |
+
label="Security & Compliance ($)",
|
| 1214 |
+
value=250000,
|
| 1215 |
+
elem_classes="number-input",
|
| 1216 |
+
precision=0)
|
| 1217 |
+
|
| 1218 |
+
with gr.Row(elem_classes="button-container"):
|
| 1219 |
+
back_button3_5 = gr.Button("← Back",
|
| 1220 |
+
elem_classes="back-button")
|
| 1221 |
+
calculate_button_with_comparison = gr.Button(
|
| 1222 |
+
"Generate Recommendations with Comparison ✨",
|
| 1223 |
+
elem_classes="calculate-button")
|
| 1224 |
+
|
| 1225 |
+
|
| 1226 |
+
with gr.Column(visible=False,
|
| 1227 |
+
elem_id="step4",
|
| 1228 |
+
elem_classes="section-container") as step4:
|
| 1229 |
+
gr.Markdown("## Your Personalized AI Security Plan",
|
| 1230 |
+
elem_classes="section-title")
|
| 1231 |
+
|
| 1232 |
+
gr.Markdown("""<div class="info-card">
|
| 1233 |
+
<div class="info-card-title">Your Customized Recommendation</div>
|
| 1234 |
+
Based on your inputs, we've generated a comprehensive AI security implementation plan tailored to your organization's needs, budget, and industry requirements.
|
| 1235 |
+
</div>""")
|
| 1236 |
+
|
| 1237 |
+
with gr.Tabs():
|
| 1238 |
+
with gr.Tab("Executive Summary"):
|
| 1239 |
+
recommendation_output = gr.Markdown(
|
| 1240 |
+
elem_classes="result-card")
|
| 1241 |
+
|
| 1242 |
+
with gr.Tab("Savings Analysis"):
|
| 1243 |
+
gr.Markdown("### Potential Cost Savings",
|
| 1244 |
+
elem_classes="subsection-title")
|
| 1245 |
+
gr.Markdown(
|
| 1246 |
+
"""This chart illustrates the potential monthly savings across your different tool categories by implementing AI solutions."""
|
| 1247 |
)
|
| 1248 |
+
subscription_chart = gr.Plot(
|
| 1249 |
+
elem_classes="chart-container")
|
| 1250 |
|
| 1251 |
+
with gr.Tab("Build vs Buy Comparison"):
|
| 1252 |
+
gr.Markdown("### Build vs Buy Analysis",
|
| 1253 |
+
elem_classes="subsection-title")
|
| 1254 |
+
gr.Markdown(
|
| 1255 |
+
"""This chart compares the cost of building and maintaining your own AI security platform versus using Preamble's enterprise solution over 3 years."""
|
| 1256 |
)
|
| 1257 |
+
build_vs_buy_chart = gr.Plot(
|
| 1258 |
+
elem_classes="chart-container")
|
| 1259 |
|
| 1260 |
+
gr.Markdown(
|
| 1261 |
+
"""<div class="helper-text" style="margin-top: 20px; text-align: center;">
|
| 1262 |
+
Want to learn more about implementing these recommendations? Contact our team at <a href="mailto:sales@preamble.com" style="color: #FFC700;">sales@preamble.com</a>
|
| 1263 |
+
</div>""")
|
| 1264 |
|
| 1265 |
+
with gr.Row(elem_classes="center-button-container"):
|
| 1266 |
+
restart_button = gr.Button("Start Over",
|
| 1267 |
+
elem_classes="calculate-button")
|
| 1268 |
+
|
| 1269 |
+
|
| 1270 |
+
def update_progress_indicator(step):
|
| 1271 |
+
return [
|
| 1272 |
+
gr.update(elem_classes="timeline-step active" if i ==
|
| 1273 |
+
step else "timeline-step") for i in range(1, 5)
|
| 1274 |
+
]
|
| 1275 |
+
|
| 1276 |
+
def go_to_step1(step):
|
| 1277 |
+
indicators = update_progress_indicator(1)
|
| 1278 |
+
return (gr.update(visible=True), gr.update(visible=False),
|
| 1279 |
+
gr.update(visible=False), gr.update(visible=False),
|
| 1280 |
+
gr.update(visible=False), 1, *indicators)
|
| 1281 |
+
|
| 1282 |
+
def go_to_step2(org_size, step):
|
| 1283 |
+
indicators = update_progress_indicator(2)
|
| 1284 |
+
total_employees = int(org_size) if org_size is not None else 0
|
| 1285 |
+
updated_departments = default_departments.copy()
|
| 1286 |
+
if total_employees != updated_departments[
|
| 1287 |
+
'Number of Employees'].sum():
|
| 1288 |
+
updated_departments.loc[
|
| 1289 |
+
updated_departments.index[-1],
|
| 1290 |
+
'Number of Employees'] += total_employees - updated_departments[
|
| 1291 |
+
'Number of Employees'].sum()
|
| 1292 |
+
|
| 1293 |
+
updated_subscriptions = default_subscriptions.copy()
|
| 1294 |
+
updated_subscriptions['Number of Users'] = total_employees
|
| 1295 |
+
|
| 1296 |
+
return (gr.update(visible=False), gr.update(visible=True),
|
| 1297 |
+
gr.update(visible=False), gr.update(visible=False),
|
| 1298 |
+
gr.update(visible=False), gr.update(value=2),
|
| 1299 |
+
gr.update(value=total_employees), gr.update(value=updated_departments),
|
| 1300 |
+
gr.update(value=updated_subscriptions), *indicators)
|
| 1301 |
+
|
| 1302 |
+
def go_to_step3(industry, step):
|
| 1303 |
+
indicators = update_progress_indicator(3)
|
| 1304 |
+
new_compliance_data = industry_compliance_data.get(
|
| 1305 |
+
industry, industry_compliance_data["Other"])
|
| 1306 |
+
new_compliance_data.columns = [
|
| 1307 |
+
"Regulation", "Potential Violations", "Penalty",
|
| 1308 |
+
"Attorney Cost"
|
| 1309 |
+
]
|
| 1310 |
+
return (gr.update(visible=False), gr.update(visible=False),
|
| 1311 |
+
gr.update(visible=True), gr.update(visible=False),
|
| 1312 |
+
gr.update(visible=False), gr.update(value=new_compliance_data),
|
| 1313 |
+
gr.update(value=3), *indicators)
|
| 1314 |
+
|
| 1315 |
+
def go_to_step3_5(step):
|
| 1316 |
+
indicators = update_progress_indicator(3)
|
| 1317 |
+
return (gr.update(visible=False), gr.update(visible=False),
|
| 1318 |
+
gr.update(visible=False), gr.update(visible=True),
|
| 1319 |
+
gr.update(visible=False), gr.update(value=3), *indicators)
|
| 1320 |
+
|
| 1321 |
+
def generate_recommendations_and_go_to_step4(
|
| 1322 |
+
industry, org_size, monthly_budget, has_ai_app, api_calls,
|
| 1323 |
+
department_df, subscription_df, compliance_df, step):
|
| 1324 |
+
dept_roi_results = calculate_department_roi(department_df)
|
| 1325 |
+
sub_savings = calculate_subscription_savings(subscription_df)
|
| 1326 |
+
comp_savings = calculate_compliance_savings(compliance_df)
|
| 1327 |
+
report = generate_recommendations(industry, org_size,
|
| 1328 |
+
monthly_budget, has_ai_app,
|
| 1329 |
+
dept_roi_results,
|
| 1330 |
+
sub_savings, comp_savings,
|
| 1331 |
+
api_calls)[0] # Only get the report
|
| 1332 |
+
chart = create_subscription_savings_chart(subscription_df)
|
| 1333 |
+
indicators = update_progress_indicator(4)
|
| 1334 |
+
return (gr.update(visible=False), gr.update(visible=False),
|
| 1335 |
+
gr.update(visible=False), gr.update(visible=False),
|
| 1336 |
+
gr.update(visible=True), report, chart, chart, *indicators)
|
| 1337 |
+
|
| 1338 |
+
def generate_recommendations_with_comparison(
|
| 1339 |
+
industry, org_size, monthly_budget, has_ai_app, api_calls,
|
| 1340 |
+
department_df, subscription_df, compliance_df,
|
| 1341 |
+
initial_dev_cost, num_ai_personnel, avg_annual_salary,
|
| 1342 |
+
annual_maintenance, security_compliance, step):
|
| 1343 |
+
dept_roi_results = calculate_department_roi(department_df)
|
| 1344 |
+
sub_savings = calculate_subscription_savings(subscription_df)
|
| 1345 |
+
comp_savings = calculate_compliance_savings(compliance_df)
|
| 1346 |
+
report, comparison = generate_recommendations(
|
| 1347 |
+
industry, org_size, monthly_budget, has_ai_app,
|
| 1348 |
+
dept_roi_results, sub_savings, comp_savings, api_calls,
|
| 1349 |
+
initial_dev_cost, num_ai_personnel, avg_annual_salary,
|
| 1350 |
+
annual_maintenance, security_compliance)
|
| 1351 |
+
subscription_chart = create_subscription_savings_chart(subscription_df)
|
| 1352 |
+
comparison_chart = create_build_vs_buy_chart(comparison)
|
| 1353 |
+
indicators = update_progress_indicator(4)
|
| 1354 |
+
return (gr.update(visible=False), gr.update(visible=False),
|
| 1355 |
+
gr.update(visible=False), gr.update(visible=False),
|
| 1356 |
+
gr.update(visible=True), report, subscription_chart,
|
| 1357 |
+
comparison_chart, *indicators)
|
| 1358 |
+
|
| 1359 |
+
|
| 1360 |
+
next_button1.click(fn=go_to_step2,
|
| 1361 |
+
inputs=[org_size, current_step],
|
| 1362 |
+
outputs=[
|
| 1363 |
+
step1, step2, step3, step3_5, step4, current_step,
|
| 1364 |
+
total_employees_state, department_data,
|
| 1365 |
+
subscription_data, step1_indicator,
|
| 1366 |
+
step2_indicator, step3_indicator, step4_indicator
|
| 1367 |
+
])
|
| 1368 |
+
|
| 1369 |
+
back_button2.click(fn=go_to_step1,
|
| 1370 |
+
inputs=[current_step],
|
| 1371 |
+
outputs=[
|
| 1372 |
+
step1, step2, step3, step3_5, step4, current_step,
|
| 1373 |
+
step1_indicator, step2_indicator, step3_indicator,
|
| 1374 |
+
step4_indicator
|
| 1375 |
+
])
|
| 1376 |
+
next_button2.click(fn=go_to_step3,
|
| 1377 |
+
inputs=[industry, current_step],
|
| 1378 |
+
outputs=[
|
| 1379 |
+
step1, step2, step3, step3_5, step4, compliance_data,
|
| 1380 |
+
current_step, step1_indicator, step2_indicator,
|
| 1381 |
+
step3_indicator, step4_indicator
|
| 1382 |
+
])
|
| 1383 |
+
|
| 1384 |
+
|
| 1385 |
+
back_button3.click(fn=go_to_step2,
|
| 1386 |
+
inputs=[org_size, current_step],
|
| 1387 |
+
outputs=[
|
| 1388 |
+
step1, step2, step3, step3_5, step4, current_step,
|
| 1389 |
+
total_employees_state, department_data,
|
| 1390 |
+
subscription_data, step1_indicator,
|
| 1391 |
+
step2_indicator, step3_indicator, step4_indicator
|
| 1392 |
+
])
|
| 1393 |
+
|
| 1394 |
+
next_button3.click(fn=go_to_step3_5,
|
| 1395 |
+
inputs=[current_step],
|
| 1396 |
+
outputs=[
|
| 1397 |
+
step1, step2, step3, step3_5, step4,
|
| 1398 |
+
current_step, step1_indicator, step2_indicator,
|
| 1399 |
+
step3_indicator, step4_indicator
|
| 1400 |
+
])
|
| 1401 |
+
|
| 1402 |
+
back_button3_5.click(fn=go_to_step3,
|
| 1403 |
+
inputs=[industry, current_step],
|
| 1404 |
+
outputs=[
|
| 1405 |
+
step1, step2, step3, step3_5, step4, compliance_data,
|
| 1406 |
+
current_step, step1_indicator, step2_indicator,
|
| 1407 |
+
step3_indicator, step4_indicator
|
| 1408 |
+
])
|
| 1409 |
+
|
| 1410 |
+
calculate_button.click(fn=generate_recommendations_and_go_to_step4,
|
| 1411 |
+
inputs=[
|
| 1412 |
+
industry, org_size, monthly_budget,
|
| 1413 |
+
has_ai_app, api_calls, department_data,
|
| 1414 |
+
subscription_data, compliance_data,
|
| 1415 |
+
current_step
|
| 1416 |
+
],
|
| 1417 |
+
outputs=[
|
| 1418 |
+
step1, step2, step3, step3_5, step4,
|
| 1419 |
+
recommendation_output,
|
| 1420 |
+
subscription_chart, build_vs_buy_chart, step1_indicator,
|
| 1421 |
+
step2_indicator, step3_indicator, step4_indicator
|
| 1422 |
+
])
|
| 1423 |
+
|
| 1424 |
+
calculate_button_with_comparison.click(
|
| 1425 |
+
fn=generate_recommendations_with_comparison,
|
| 1426 |
+
inputs=[
|
| 1427 |
+
industry, org_size, monthly_budget, has_ai_app,
|
| 1428 |
+
api_calls, department_data, subscription_data,
|
| 1429 |
+
compliance_data, initial_dev_cost, num_ai_personnel,
|
| 1430 |
+
avg_annual_salary, annual_maintenance,
|
| 1431 |
+
security_compliance, current_step
|
| 1432 |
+
],
|
| 1433 |
+
outputs=[
|
| 1434 |
+
step1, step2, step3, step3_5, step4,
|
| 1435 |
+
recommendation_output, subscription_chart,
|
| 1436 |
+
build_vs_buy_chart, step1_indicator, step2_indicator,
|
| 1437 |
+
step3_indicator, step4_indicator
|
| 1438 |
+
]
|
| 1439 |
)
|
| 1440 |
+
|
| 1441 |
+
restart_button.click(fn=go_to_step1,
|
| 1442 |
+
inputs=[current_step],
|
| 1443 |
+
outputs=[
|
| 1444 |
+
step1, step2, step3, step3_5, step4, current_step,
|
| 1445 |
+
step1_indicator, step2_indicator, step3_indicator,
|
| 1446 |
+
step4_indicator
|
| 1447 |
+
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1448 |
|
| 1449 |
return roi_app
|
| 1450 |
|
| 1451 |
+
|
| 1452 |
app = create_app()
|
| 1453 |
|
| 1454 |
if __name__ == "__main__":
|
| 1455 |
app.launch()
|
| 1456 |
|
| 1457 |
+
#Preamble, Inc. 2025
|
| 1458 |
+
#AI ROI Calc
|
| 1459 |
+
#web https://preamble.com
|
|
|