Spaces:
Sleeping
Sleeping
Update app/main.py
Browse files- app/main.py +643 -645
app/main.py
CHANGED
|
@@ -1,646 +1,644 @@
|
|
| 1 |
-
"""
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
import
|
| 7 |
-
|
| 8 |
-
import
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
from
|
| 16 |
-
from
|
| 17 |
-
from
|
| 18 |
-
from
|
| 19 |
-
from
|
| 20 |
-
from
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 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 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
if '
|
| 169 |
-
st.session_state.
|
| 170 |
-
if '
|
| 171 |
-
st.session_state.
|
| 172 |
-
if '
|
| 173 |
-
st.session_state.
|
| 174 |
-
if '
|
| 175 |
-
st.session_state.
|
| 176 |
-
if '
|
| 177 |
-
st.session_state.
|
| 178 |
-
if '
|
| 179 |
-
st.session_state.
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
st.markdown(
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
source =
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
st.session_state.use_openai
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 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 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
st.session_state.
|
| 303 |
-
|
| 304 |
-
st.session_state.
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
st.session_state.
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
)
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
st.session_state.
|
| 320 |
-
|
| 321 |
-
st.
|
| 322 |
-
st.
|
| 323 |
-
|
| 324 |
-
st.
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
st.session_state.
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
st.
|
| 355 |
-
|
| 356 |
-
st.
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
""
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
st.
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
st.
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
"
|
| 402 |
-
st.markdown("
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
st.
|
| 414 |
-
elif "
|
| 415 |
-
st.
|
| 416 |
-
elif "
|
| 417 |
-
st.
|
| 418 |
-
|
| 419 |
-
st.
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
-
|
| 428 |
-
|
| 429 |
-
|
| 430 |
-
|
| 431 |
-
|
| 432 |
-
|
| 433 |
-
st.
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
**Power BI
|
| 446 |
-
|
| 447 |
-
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
"
|
| 460 |
-
st.markdown("
|
| 461 |
-
|
| 462 |
-
st.
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
x_col =
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
-
|
| 496 |
-
y_col = None
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
)
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
"
|
| 533 |
-
st.markdown("
|
| 534 |
-
|
| 535 |
-
st.
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
st.markdown(f"β’ '
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
st.
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
""
|
| 566 |
-
|
| 567 |
-
st.
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
with
|
| 571 |
-
st.metric("
|
| 572 |
-
with
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
|
| 591 |
-
|
| 592 |
-
st.
|
| 593 |
-
|
| 594 |
-
|
| 595 |
-
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
'
|
| 599 |
-
'
|
| 600 |
-
'
|
| 601 |
-
|
| 602 |
-
|
| 603 |
-
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
"
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
<
|
| 612 |
-
<p
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
| 625 |
-
|
| 626 |
-
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
|
| 636 |
-
|
| 637 |
-
|
| 638 |
-
|
| 639 |
-
|
| 640 |
-
|
| 641 |
-
|
| 642 |
-
|
| 643 |
-
|
| 644 |
-
|
| 645 |
-
if __name__ == "__main__":
|
| 646 |
main()
|
|
|
|
| 1 |
+
"""Smart Analytics Copilot - Complete Version
|
| 2 |
+
With Export, OpenAI, Save/Load, Chart Customization, Power BI Export"""
|
| 3 |
+
|
| 4 |
+
import streamlit as st
|
| 5 |
+
import pandas as pd
|
| 6 |
+
import os
|
| 7 |
+
from datetime import datetime
|
| 8 |
+
from dotenv import load_dotenv
|
| 9 |
+
|
| 10 |
+
#Load environment variables
|
| 11 |
+
load_dotenv()
|
| 12 |
+
|
| 13 |
+
from data_processor import DataProcessor
|
| 14 |
+
from analyzer import Analyzer
|
| 15 |
+
from insight_generator import InsightGenerator
|
| 16 |
+
from dashboard import DashboardGenerator
|
| 17 |
+
from query_engine import QueryEngine
|
| 18 |
+
from export_utils import ExportUtils
|
| 19 |
+
from session_manager import SessionManager
|
| 20 |
+
from chart_customizer import ChartCustomizer
|
| 21 |
+
|
| 22 |
+
#Page config
|
| 23 |
+
st.set_page_config(
|
| 24 |
+
page_title="Smart Analytics Copilot",
|
| 25 |
+
page_icon="π",
|
| 26 |
+
layout="wide",
|
| 27 |
+
initial_sidebar_state="expanded"
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
+
# ============ DARK THEME CSS ============
|
| 31 |
+
st.markdown("""
|
| 32 |
+
<style>
|
| 33 |
+
/* Main background */
|
| 34 |
+
.stApp {
|
| 35 |
+
background-color: #0a0e17 !important;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
/* All text - light color */
|
| 39 |
+
.stMarkdown, .stMarkdown p, .stMarkdown div, .stMarkdown span,
|
| 40 |
+
.stText, p, div, span, label {
|
| 41 |
+
color: #e8e8e8 !important;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
/* Headers */
|
| 45 |
+
h1, h2, h3, h4, h5, h6 {
|
| 46 |
+
color: #00ff9d !important;
|
| 47 |
+
font-weight: 600 !important;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* Main header */
|
| 51 |
+
.main-header {
|
| 52 |
+
font-size: 2.8rem;
|
| 53 |
+
font-weight: bold;
|
| 54 |
+
background: linear-gradient(135deg, #00ff9d 0%, #00d4ff 100%);
|
| 55 |
+
-webkit-background-clip: text;
|
| 56 |
+
-webkit-text-fill-color: transparent;
|
| 57 |
+
margin-bottom: 1rem;
|
| 58 |
+
text-align: center;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
/* Sidebar */
|
| 62 |
+
.css-1d391kg, .stSidebar, .sidebar-content {
|
| 63 |
+
background-color: #111827 !important;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
/* Metrics */
|
| 67 |
+
div[data-testid="stMetricValue"] {
|
| 68 |
+
color: #00ff9d !important;
|
| 69 |
+
font-size: 2rem !important;
|
| 70 |
+
font-weight: bold !important;
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
div[data-testid="stMetricLabel"] {
|
| 74 |
+
color: #a0aec0 !important;
|
| 75 |
+
font-size: 0.9rem !important;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/* Tabs */
|
| 79 |
+
.stTabs [data-baseweb="tab-list"] {
|
| 80 |
+
gap: 4px;
|
| 81 |
+
background-color: #111827;
|
| 82 |
+
border-radius: 10px;
|
| 83 |
+
padding: 6px;
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
.stTabs [data-baseweb="tab"] {
|
| 87 |
+
background-color: #1f2937;
|
| 88 |
+
border-radius: 8px;
|
| 89 |
+
padding: 8px 24px;
|
| 90 |
+
color: #e8e8e8 !important;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.stTabs [aria-selected="true"] {
|
| 94 |
+
background: linear-gradient(135deg, #00ff9d 0%, #00d4ff 100%) !important;
|
| 95 |
+
color: #0a0e17 !important;
|
| 96 |
+
font-weight: bold;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
/* Buttons */
|
| 100 |
+
.stButton button {
|
| 101 |
+
background: linear-gradient(135deg, #00ff9d 0%, #00d4ff 100%) !important;
|
| 102 |
+
color: #0a0e17 !important;
|
| 103 |
+
font-weight: bold !important;
|
| 104 |
+
border: none !important;
|
| 105 |
+
border-radius: 8px !important;
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
+
/* File uploader */
|
| 109 |
+
.stFileUploader {
|
| 110 |
+
background-color: #1f2937 !important;
|
| 111 |
+
border: 2px dashed #374151 !important;
|
| 112 |
+
border-radius: 12px !important;
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/* Expander */
|
| 116 |
+
.streamlit-expanderHeader {
|
| 117 |
+
background-color: #1f2937 !important;
|
| 118 |
+
color: #00ff9d !important;
|
| 119 |
+
border-radius: 8px;
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/* Success/Info/Warning boxes */
|
| 123 |
+
.stAlert {
|
| 124 |
+
background-color: #1f2937 !important;
|
| 125 |
+
border: 1px solid #374151 !important;
|
| 126 |
+
border-radius: 10px !important;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.stAlert p, .stAlert div {
|
| 130 |
+
color: #e8e8e8 !important;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
/* Dataframe */
|
| 134 |
+
.stDataFrame {
|
| 135 |
+
background-color: #111827 !important;
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
.stDataFrame thead th {
|
| 139 |
+
background-color: #1f2937 !important;
|
| 140 |
+
color: #00ff9d !important;
|
| 141 |
+
}
|
| 142 |
+
|
| 143 |
+
/* Text input */
|
| 144 |
+
.stTextInput input {
|
| 145 |
+
background-color: #1f2937 !important;
|
| 146 |
+
color: #e8e8e8 !important;
|
| 147 |
+
border: 1px solid #374151 !important;
|
| 148 |
+
border-radius: 8px !important;
|
| 149 |
+
}
|
| 150 |
+
|
| 151 |
+
/* Select box */
|
| 152 |
+
.stSelectbox div[data-baseweb="select"] {
|
| 153 |
+
background-color: #1f2937 !important;
|
| 154 |
+
border-color: #374151 !important;
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
/* Download button */
|
| 158 |
+
.stDownloadButton button {
|
| 159 |
+
background: linear-gradient(135deg, #00ff9d 0%, #00d4ff 100%) !important;
|
| 160 |
+
color: #0a0e17 !important;
|
| 161 |
+
}
|
| 162 |
+
</style>
|
| 163 |
+
""", unsafe_allow_html=True)
|
| 164 |
+
|
| 165 |
+
# Initialize session state
|
| 166 |
+
if 'data_loaded' not in st.session_state:
|
| 167 |
+
st.session_state.data_loaded = False
|
| 168 |
+
if 'df' not in st.session_state:
|
| 169 |
+
st.session_state.df = None
|
| 170 |
+
if 'schema' not in st.session_state:
|
| 171 |
+
st.session_state.schema = None
|
| 172 |
+
if 'analysis' not in st.session_state:
|
| 173 |
+
st.session_state.analysis = None
|
| 174 |
+
if 'insights' not in st.session_state:
|
| 175 |
+
st.session_state.insights = None
|
| 176 |
+
if 'charts' not in st.session_state:
|
| 177 |
+
st.session_state.charts = None
|
| 178 |
+
if 'use_openai' not in st.session_state:
|
| 179 |
+
st.session_state.use_openai = False
|
| 180 |
+
|
| 181 |
+
# Initialize managers
|
| 182 |
+
session_mgr = SessionManager()
|
| 183 |
+
|
| 184 |
+
|
| 185 |
+
def main():
|
| 186 |
+
st.markdown('<div class="main-header">π Smart Analytics Copilot</div>', unsafe_allow_html=True)
|
| 187 |
+
st.caption("β¨ Upload any CSV/JSON - AI analyzes, visualizes, and answers questions")
|
| 188 |
+
st.markdown("---")
|
| 189 |
+
|
| 190 |
+
# Sidebar
|
| 191 |
+
with st.sidebar:
|
| 192 |
+
st.markdown("### π Data Source")
|
| 193 |
+
|
| 194 |
+
# Data source selection
|
| 195 |
+
source = st.radio("Choose data source:", ["π€ Upload File", "πΎ Load Saved Session"])
|
| 196 |
+
|
| 197 |
+
if source == "π€ Upload File":
|
| 198 |
+
uploaded_file = st.file_uploader("Choose CSV or JSON", type=['csv', 'json'])
|
| 199 |
+
if uploaded_file and not st.session_state.data_loaded:
|
| 200 |
+
with st.spinner("π Processing your data..."):
|
| 201 |
+
process_data(uploaded_file)
|
| 202 |
+
else:
|
| 203 |
+
# Load saved sessions
|
| 204 |
+
sessions = session_mgr.list_sessions()
|
| 205 |
+
if sessions:
|
| 206 |
+
session_names = [s['name'] for s in sessions]
|
| 207 |
+
selected_session = st.selectbox("Select saved session:", session_names)
|
| 208 |
+
if st.button("π Load Session"):
|
| 209 |
+
with st.spinner("Loading..."):
|
| 210 |
+
load_session(selected_session)
|
| 211 |
+
else:
|
| 212 |
+
st.info("No saved sessions found")
|
| 213 |
+
|
| 214 |
+
st.markdown("---")
|
| 215 |
+
|
| 216 |
+
# Settings
|
| 217 |
+
with st.expander("βοΈ Settings"):
|
| 218 |
+
st.session_state.use_openai = st.checkbox("Use OpenAI (better insights)",
|
| 219 |
+
value=st.session_state.use_openai)
|
| 220 |
+
if st.session_state.use_openai:
|
| 221 |
+
api_key = st.text_input("OpenAI API Key:", type="password")
|
| 222 |
+
if api_key:
|
| 223 |
+
os.environ['OPENAI_API_KEY'] = api_key
|
| 224 |
+
st.success("API Key set!")
|
| 225 |
+
|
| 226 |
+
st.markdown("---")
|
| 227 |
+
|
| 228 |
+
# Export section (only if data loaded)
|
| 229 |
+
if st.session_state.data_loaded:
|
| 230 |
+
st.markdown("### πΎ Export Options")
|
| 231 |
+
export_utils = ExportUtils(st.session_state.df)
|
| 232 |
+
|
| 233 |
+
export_format = st.selectbox("Export format:",
|
| 234 |
+
["CSV", "Excel", "JSON", "Power BI CSV", "Power BI ZIP (Complete)"])
|
| 235 |
+
|
| 236 |
+
if st.button("π₯ Download"):
|
| 237 |
+
if export_format == "CSV":
|
| 238 |
+
data = export_utils.to_csv()
|
| 239 |
+
mime = "text/csv"
|
| 240 |
+
ext = "csv"
|
| 241 |
+
elif export_format == "Excel":
|
| 242 |
+
data = export_utils.to_excel()
|
| 243 |
+
mime = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
| 244 |
+
ext = "xlsx"
|
| 245 |
+
elif export_format == "JSON":
|
| 246 |
+
data = export_utils.to_json()
|
| 247 |
+
mime = "application/json"
|
| 248 |
+
ext = "json"
|
| 249 |
+
elif export_format == "Power BI CSV":
|
| 250 |
+
data = export_utils.to_powerbi_ready()
|
| 251 |
+
mime = "text/csv"
|
| 252 |
+
ext = "csv"
|
| 253 |
+
else: # Power BI ZIP (Complete)
|
| 254 |
+
data = export_utils.to_powerbi_zip()
|
| 255 |
+
mime = "application/zip"
|
| 256 |
+
ext = "zip"
|
| 257 |
+
|
| 258 |
+
st.download_button(
|
| 259 |
+
label="β
Click to Download",
|
| 260 |
+
data=data,
|
| 261 |
+
file_name=f"export_{datetime.now().strftime('%Y%m%d_%H%M%S')}.{ext}",
|
| 262 |
+
mime=mime
|
| 263 |
+
)
|
| 264 |
+
|
| 265 |
+
# Save session button
|
| 266 |
+
st.markdown("---")
|
| 267 |
+
if st.button("πΎ Save Current Session"):
|
| 268 |
+
name, path = session_mgr.save_session(st.session_state.df, st.session_state.schema)
|
| 269 |
+
st.success(f"β
Session saved as: {name}")
|
| 270 |
+
|
| 271 |
+
# Main content
|
| 272 |
+
if st.session_state.data_loaded:
|
| 273 |
+
tab1, tab2, tab3, tab4, tab5 = st.tabs([
|
| 274 |
+
"π Dashboard", "π‘ AI Insights", "π¨ Custom Charts", "π Query", "π Data"
|
| 275 |
+
])
|
| 276 |
+
|
| 277 |
+
with tab1:
|
| 278 |
+
show_dashboard()
|
| 279 |
+
|
| 280 |
+
with tab2:
|
| 281 |
+
show_insights()
|
| 282 |
+
|
| 283 |
+
with tab3:
|
| 284 |
+
show_chart_customizer()
|
| 285 |
+
|
| 286 |
+
with tab4:
|
| 287 |
+
show_query_interface()
|
| 288 |
+
|
| 289 |
+
with tab5:
|
| 290 |
+
show_data_preview()
|
| 291 |
+
|
| 292 |
+
else:
|
| 293 |
+
show_welcome()
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
def process_data(uploaded_file):
|
| 297 |
+
"""Process uploaded data"""
|
| 298 |
+
try:
|
| 299 |
+
processor = DataProcessor()
|
| 300 |
+
st.session_state.df = processor.load_from_upload(uploaded_file)
|
| 301 |
+
st.session_state.df = processor.preprocess()
|
| 302 |
+
st.session_state.schema = processor.detect_schema()
|
| 303 |
+
|
| 304 |
+
analyzer = Analyzer(st.session_state.df, st.session_state.schema)
|
| 305 |
+
st.session_state.analysis = analyzer.run_full_analysis()
|
| 306 |
+
|
| 307 |
+
# Use OpenAI if enabled
|
| 308 |
+
api_key = os.environ.get('OPENAI_API_KEY')
|
| 309 |
+
insight_gen = InsightGenerator(use_openai=st.session_state.use_openai, api_key=api_key)
|
| 310 |
+
st.session_state.insights = insight_gen.generate_insights(
|
| 311 |
+
st.session_state.df,
|
| 312 |
+
st.session_state.schema,
|
| 313 |
+
st.session_state.analysis
|
| 314 |
+
)
|
| 315 |
+
|
| 316 |
+
dashboard_gen = DashboardGenerator(st.session_state.df, st.session_state.schema)
|
| 317 |
+
st.session_state.charts = dashboard_gen.generate_all_charts()
|
| 318 |
+
|
| 319 |
+
st.session_state.data_loaded = True
|
| 320 |
+
st.success(f"β
Successfully loaded {len(st.session_state.df):,} rows with {len(st.session_state.df.columns)} columns")
|
| 321 |
+
st.balloons()
|
| 322 |
+
st.rerun()
|
| 323 |
+
except Exception as e:
|
| 324 |
+
st.error(f"Error: {e}")
|
| 325 |
+
|
| 326 |
+
|
| 327 |
+
def load_session(session_name):
|
| 328 |
+
"""Load saved session and regenerate insights"""
|
| 329 |
+
session = session_mgr.load_session(session_name)
|
| 330 |
+
if session:
|
| 331 |
+
st.session_state.df = session['df']
|
| 332 |
+
st.session_state.schema = session['schema']
|
| 333 |
+
|
| 334 |
+
# Regenerate analysis and insights for loaded session
|
| 335 |
+
with st.spinner("π Regenerating analysis..."):
|
| 336 |
+
analyzer = Analyzer(st.session_state.df, st.session_state.schema)
|
| 337 |
+
st.session_state.analysis = analyzer.run_full_analysis()
|
| 338 |
+
|
| 339 |
+
# Regenerate insights
|
| 340 |
+
api_key = os.environ.get('OPENAI_API_KEY')
|
| 341 |
+
insight_gen = InsightGenerator(use_openai=st.session_state.use_openai, api_key=api_key)
|
| 342 |
+
st.session_state.insights = insight_gen.generate_insights(
|
| 343 |
+
st.session_state.df,
|
| 344 |
+
st.session_state.schema,
|
| 345 |
+
st.session_state.analysis
|
| 346 |
+
)
|
| 347 |
+
|
| 348 |
+
# Regenerate charts
|
| 349 |
+
dashboard_gen = DashboardGenerator(st.session_state.df, st.session_state.schema)
|
| 350 |
+
st.session_state.charts = dashboard_gen.generate_all_charts()
|
| 351 |
+
|
| 352 |
+
st.session_state.data_loaded = True
|
| 353 |
+
st.success(f"β
Loaded session: {session_name}")
|
| 354 |
+
st.rerun()
|
| 355 |
+
else:
|
| 356 |
+
st.error("Failed to load session")
|
| 357 |
+
|
| 358 |
+
|
| 359 |
+
def show_dashboard():
|
| 360 |
+
"""Display dashboard"""
|
| 361 |
+
st.markdown("### π Key Metrics")
|
| 362 |
+
st.markdown("---")
|
| 363 |
+
|
| 364 |
+
# Check if data exists
|
| 365 |
+
if st.session_state.df is None:
|
| 366 |
+
st.warning("No data loaded. Please upload a file first.")
|
| 367 |
+
return
|
| 368 |
+
|
| 369 |
+
# Display metrics
|
| 370 |
+
if st.session_state.schema['numeric']:
|
| 371 |
+
cols = st.columns(min(4, len(st.session_state.schema['numeric'])))
|
| 372 |
+
for idx, col in enumerate(st.session_state.schema['numeric'][:4]):
|
| 373 |
+
with cols[idx]:
|
| 374 |
+
total = st.session_state.df[col].sum()
|
| 375 |
+
avg = st.session_state.df[col].mean()
|
| 376 |
+
st.metric(
|
| 377 |
+
label=f"π° {col.upper()}",
|
| 378 |
+
value=f"{total:,.0f}",
|
| 379 |
+
delta=f"Avg: {avg:,.0f}"
|
| 380 |
+
)
|
| 381 |
+
|
| 382 |
+
st.markdown("---")
|
| 383 |
+
st.markdown("### π Visualizations")
|
| 384 |
+
|
| 385 |
+
if st.session_state.charts:
|
| 386 |
+
for chart in st.session_state.charts[:4]:
|
| 387 |
+
st.plotly_chart(chart['figure'], use_container_width=True)
|
| 388 |
+
else:
|
| 389 |
+
st.info("No charts available. Try uploading data first.")
|
| 390 |
+
|
| 391 |
+
st.markdown("---")
|
| 392 |
+
st.markdown("### π Summary Statistics")
|
| 393 |
+
if st.session_state.schema['numeric']:
|
| 394 |
+
summary = st.session_state.df[st.session_state.schema['numeric']].describe()
|
| 395 |
+
st.dataframe(summary, use_container_width=True)
|
| 396 |
+
|
| 397 |
+
|
| 398 |
+
def show_insights():
|
| 399 |
+
"""Display AI insights"""
|
| 400 |
+
st.markdown("### π§ AI-Powered Insights")
|
| 401 |
+
st.markdown("Here's what we discovered in your data:")
|
| 402 |
+
st.markdown("---")
|
| 403 |
+
|
| 404 |
+
# Check if insights exist
|
| 405 |
+
if st.session_state.insights is None:
|
| 406 |
+
st.info("π‘ Insights will appear after data is analyzed.")
|
| 407 |
+
return
|
| 408 |
+
|
| 409 |
+
for insight in st.session_state.insights:
|
| 410 |
+
if "Dataset" in insight:
|
| 411 |
+
st.info(f"π {insight}")
|
| 412 |
+
elif "correlation" in insight.lower():
|
| 413 |
+
st.success(f"β
{insight}")
|
| 414 |
+
elif "skewed" in insight.lower():
|
| 415 |
+
st.warning(f"π {insight}")
|
| 416 |
+
elif "Recommendation" in insight:
|
| 417 |
+
st.info(f"π‘ {insight}")
|
| 418 |
+
else:
|
| 419 |
+
st.markdown(f"β’ {insight}")
|
| 420 |
+
|
| 421 |
+
# Power BI template section
|
| 422 |
+
st.markdown("---")
|
| 423 |
+
with st.expander("π Power BI Resources"):
|
| 424 |
+
export_utils = ExportUtils(st.session_state.df)
|
| 425 |
+
|
| 426 |
+
col1, col2 = st.columns(2)
|
| 427 |
+
|
| 428 |
+
with col1:
|
| 429 |
+
# Show DAX template
|
| 430 |
+
template = export_utils.get_powerbi_template()
|
| 431 |
+
st.code(template, language="dax")
|
| 432 |
+
|
| 433 |
+
st.download_button(
|
| 434 |
+
label="π₯ Download DAX Template",
|
| 435 |
+
data=template,
|
| 436 |
+
file_name="powerbi_measures.dax",
|
| 437 |
+
mime="text/plain"
|
| 438 |
+
)
|
| 439 |
+
|
| 440 |
+
with col2:
|
| 441 |
+
# Show instructions
|
| 442 |
+
instructions = """
|
| 443 |
+
**Power BI Import Steps:**
|
| 444 |
+
|
| 445 |
+
1. **Export Data**: Use sidebar to export as "Power BI CSV"
|
| 446 |
+
2. **Open Power BI Desktop**
|
| 447 |
+
3. **Get Data** β **Text/CSV**
|
| 448 |
+
4. **Select your exported CSV**
|
| 449 |
+
5. **Click Load**
|
| 450 |
+
6. **Copy DAX measures** from above
|
| 451 |
+
7. **Create visuals** using the measures
|
| 452 |
+
"""
|
| 453 |
+
st.info(instructions)
|
| 454 |
+
|
| 455 |
+
|
| 456 |
+
def show_chart_customizer():
|
| 457 |
+
"""Show chart customization interface"""
|
| 458 |
+
st.markdown("### π¨ Custom Chart Builder")
|
| 459 |
+
st.markdown("Create your own custom visualizations")
|
| 460 |
+
st.markdown("---")
|
| 461 |
+
|
| 462 |
+
customizer = ChartCustomizer(st.session_state.df)
|
| 463 |
+
available_charts = customizer.get_available_charts()
|
| 464 |
+
|
| 465 |
+
col1, col2, col3 = st.columns([1, 1, 1])
|
| 466 |
+
|
| 467 |
+
with col1:
|
| 468 |
+
chart_type = st.selectbox("Chart Type:", available_charts)
|
| 469 |
+
|
| 470 |
+
with col2:
|
| 471 |
+
# Get appropriate columns
|
| 472 |
+
if 'Histogram' in chart_type or 'Box' in chart_type:
|
| 473 |
+
columns = st.session_state.schema['numeric']
|
| 474 |
+
if not columns:
|
| 475 |
+
columns = list(st.session_state.df.select_dtypes(include=['number']).columns)
|
| 476 |
+
elif 'Pie' in chart_type or 'Bar' in chart_type:
|
| 477 |
+
columns = st.session_state.schema['categorical']
|
| 478 |
+
if not columns:
|
| 479 |
+
columns = list(st.session_state.df.select_dtypes(include=['object']).columns)
|
| 480 |
+
else:
|
| 481 |
+
columns = list(st.session_state.df.columns)
|
| 482 |
+
|
| 483 |
+
if columns:
|
| 484 |
+
x_col = st.selectbox("X-Axis / Category:", columns)
|
| 485 |
+
else:
|
| 486 |
+
x_col = None
|
| 487 |
+
st.warning("No suitable columns found")
|
| 488 |
+
|
| 489 |
+
with col3:
|
| 490 |
+
# For charts that need Y-axis
|
| 491 |
+
if any(t in chart_type for t in ['Line', 'Scatter', 'Bar']) and 'Histogram' not in chart_type:
|
| 492 |
+
y_cols = ['None'] + st.session_state.schema['numeric']
|
| 493 |
+
y_col = st.selectbox("Y-Axis / Value:", y_cols)
|
| 494 |
+
y_col = None if y_col == 'None' else y_col
|
| 495 |
+
else:
|
| 496 |
+
y_col = None
|
| 497 |
+
|
| 498 |
+
# Color column (optional)
|
| 499 |
+
color_cols = ['None'] + st.session_state.schema['categorical']
|
| 500 |
+
color_col = st.selectbox("Color By (optional):", color_cols)
|
| 501 |
+
color_col = None if color_col == 'None' else color_col
|
| 502 |
+
|
| 503 |
+
# Title
|
| 504 |
+
title = st.text_input("Chart Title:", value=f"{chart_type} of {x_col if x_col else 'data'}")
|
| 505 |
+
|
| 506 |
+
if st.button("π¨ Generate Chart", use_container_width=True):
|
| 507 |
+
if x_col:
|
| 508 |
+
with st.spinner("Creating chart..."):
|
| 509 |
+
fig = customizer.create_chart(chart_type, x_col, y_col, color_col, title)
|
| 510 |
+
if fig:
|
| 511 |
+
st.plotly_chart(fig, use_container_width=True)
|
| 512 |
+
|
| 513 |
+
# Download chart button
|
| 514 |
+
try:
|
| 515 |
+
st.download_button(
|
| 516 |
+
label="πΈ Download as PNG",
|
| 517 |
+
data=fig.to_image(format="png"),
|
| 518 |
+
file_name="custom_chart.png",
|
| 519 |
+
mime="image/png"
|
| 520 |
+
)
|
| 521 |
+
except:
|
| 522 |
+
st.info("π‘ Install kaleido for PNG export: `pip install kaleido`")
|
| 523 |
+
else:
|
| 524 |
+
st.error("Could not create chart. Try different settings.")
|
| 525 |
+
else:
|
| 526 |
+
st.error("Please select a column for X-Axis")
|
| 527 |
+
|
| 528 |
+
|
| 529 |
+
def show_query_interface():
|
| 530 |
+
"""Natural language query interface"""
|
| 531 |
+
st.markdown("### π¬ Natural Language Query")
|
| 532 |
+
st.markdown("Ask any question about your data in plain English:")
|
| 533 |
+
st.markdown("---")
|
| 534 |
+
|
| 535 |
+
query_engine = QueryEngine(st.session_state.df, st.session_state.schema)
|
| 536 |
+
|
| 537 |
+
# Example questions
|
| 538 |
+
with st.expander("π View Example Questions"):
|
| 539 |
+
if st.session_state.schema['numeric']:
|
| 540 |
+
example_col = st.session_state.schema['numeric'][0]
|
| 541 |
+
st.markdown(f"β’ 'Statistics {example_col}'")
|
| 542 |
+
st.markdown(f"β’ 'Total {example_col}'")
|
| 543 |
+
st.markdown(f"β’ 'Average {example_col}'")
|
| 544 |
+
|
| 545 |
+
if st.session_state.schema['categorical'] and st.session_state.schema['numeric']:
|
| 546 |
+
st.markdown(f"β’ 'Top 5 {st.session_state.schema['categorical'][0]} by {st.session_state.schema['numeric'][0]}'")
|
| 547 |
+
|
| 548 |
+
st.markdown("β’ 'Summary statistics'")
|
| 549 |
+
st.markdown("β’ 'Show me the data'")
|
| 550 |
+
|
| 551 |
+
st.markdown("---")
|
| 552 |
+
|
| 553 |
+
question = st.text_input("Ask a question:", placeholder="e.g., What is the average of time_in_hospital?")
|
| 554 |
+
|
| 555 |
+
if question:
|
| 556 |
+
with st.spinner("π€ Analyzing your question..."):
|
| 557 |
+
answer = query_engine.answer_question(question)
|
| 558 |
+
st.markdown("### β
Answer")
|
| 559 |
+
st.success(answer)
|
| 560 |
+
|
| 561 |
+
|
| 562 |
+
def show_data_preview():
|
| 563 |
+
"""Show data preview and info with better formatting"""
|
| 564 |
+
st.markdown("### π Data Preview")
|
| 565 |
+
st.markdown("---")
|
| 566 |
+
|
| 567 |
+
col1, col2, col3 = st.columns(3)
|
| 568 |
+
with col1:
|
| 569 |
+
st.metric("π Total Rows", f"{len(st.session_state.df):,}")
|
| 570 |
+
with col2:
|
| 571 |
+
st.metric("π Total Columns", len(st.session_state.df.columns))
|
| 572 |
+
with col3:
|
| 573 |
+
memory = st.session_state.df.memory_usage(deep=True).sum() / 1024**2
|
| 574 |
+
st.metric("πΎ Memory Usage", f"{memory:.2f} MB")
|
| 575 |
+
|
| 576 |
+
st.markdown("---")
|
| 577 |
+
st.markdown("### π Data Sample (First 100 rows)")
|
| 578 |
+
|
| 579 |
+
# Create a copy for display
|
| 580 |
+
display_df = st.session_state.df.head(100).copy()
|
| 581 |
+
|
| 582 |
+
# Clean datetime columns for better display
|
| 583 |
+
for col in display_df.columns:
|
| 584 |
+
if 'datetime' in col.lower() or 'date' in col.lower() or 'time' in col.lower():
|
| 585 |
+
try:
|
| 586 |
+
display_df[col] = pd.to_datetime(display_df[col]).dt.strftime('%Y-%m-%d %H:%M:%S')
|
| 587 |
+
except:
|
| 588 |
+
pass
|
| 589 |
+
|
| 590 |
+
st.dataframe(display_df, use_container_width=True)
|
| 591 |
+
|
| 592 |
+
st.markdown("---")
|
| 593 |
+
st.markdown("### π Column Information")
|
| 594 |
+
|
| 595 |
+
col_info = pd.DataFrame({
|
| 596 |
+
'Column': st.session_state.df.columns,
|
| 597 |
+
'Type': st.session_state.df.dtypes.astype(str),
|
| 598 |
+
'Non-Null': st.session_state.df.count().values,
|
| 599 |
+
'Nulls': st.session_state.df.isnull().sum().values,
|
| 600 |
+
'Unique': st.session_state.df.nunique().values
|
| 601 |
+
})
|
| 602 |
+
st.dataframe(col_info, use_container_width=True)
|
| 603 |
+
|
| 604 |
+
|
| 605 |
+
def show_welcome():
|
| 606 |
+
"""Welcome screen"""
|
| 607 |
+
st.markdown("""
|
| 608 |
+
<div style="text-align: center; padding: 2rem; background: linear-gradient(135deg, #111827 0%, #0a0e17 100%); border-radius: 20px; margin: 2rem 0;">
|
| 609 |
+
<h2 style="color: #00ff9d;">π Welcome to Smart Analytics Copilot</h2>
|
| 610 |
+
<p style="font-size: 1.1rem;">Upload any CSV or JSON file and let AI analyze it instantly</p>
|
| 611 |
+
<hr>
|
| 612 |
+
<p>π <strong>Get Started</strong>: Upload a file or load a saved session from the sidebar</p>
|
| 613 |
+
</div>
|
| 614 |
+
""", unsafe_allow_html=True)
|
| 615 |
+
|
| 616 |
+
col1, col2, col3 = st.columns(3)
|
| 617 |
+
|
| 618 |
+
with col1:
|
| 619 |
+
st.markdown("""
|
| 620 |
+
<div style="background: linear-gradient(135deg, #1f2937 0%, #111827 100%); padding: 1.5rem; border-radius: 15px; text-align: center;">
|
| 621 |
+
<h3 style="color: #00ff9d;">π Auto Dashboard</h3>
|
| 622 |
+
<p>Smart charts based on your data</p>
|
| 623 |
+
</div>
|
| 624 |
+
""", unsafe_allow_html=True)
|
| 625 |
+
|
| 626 |
+
with col2:
|
| 627 |
+
st.markdown("""
|
| 628 |
+
<div style="background: linear-gradient(135deg, #1f2937 0%, #111827 100%); padding: 1.5rem; border-radius: 15px; text-align: center;">
|
| 629 |
+
<h3 style="color: #00ff9d;">π‘ AI Insights</h3>
|
| 630 |
+
<p>Natural language explanations</p>
|
| 631 |
+
</div>
|
| 632 |
+
""", unsafe_allow_html=True)
|
| 633 |
+
|
| 634 |
+
with col3:
|
| 635 |
+
st.markdown("""
|
| 636 |
+
<div style="background: linear-gradient(135deg, #1f2937 0%, #111827 100%); padding: 1.5rem; border-radius: 15px; text-align: center;">
|
| 637 |
+
<h3 style="color: #00ff9d;">π¨ Custom Charts</h3>
|
| 638 |
+
<p>Build your own visualizations</p>
|
| 639 |
+
</div>
|
| 640 |
+
""", unsafe_allow_html=True)
|
| 641 |
+
|
| 642 |
+
|
| 643 |
+
if __name__ == "__main__":
|
|
|
|
|
|
|
| 644 |
main()
|