Spaces:
Sleeping
Sleeping
| """ | |
| BnParte – Strategic BA Command Center (Light Theme with External HTML Files) | |
| Built with ❤️ and ☀️ by Sai Varakala · Techno‑Agilist · Scrum Master @ TCS | |
| © 2026 Sai Varakala · MIT License | |
| """ | |
| import gradio as gr | |
| import random | |
| from datetime import datetime | |
| import os | |
| # ============================================================================ | |
| # Read HTML files from disk (saved in the same Space) | |
| # ============================================================================ | |
| def load_html_file(filename): | |
| """Read HTML content from file, return error message if not found""" | |
| try: | |
| with open(filename, 'r', encoding='utf-8') as f: | |
| return f.read() | |
| except FileNotFoundError: | |
| return f""" | |
| <div style="text-align: center; padding: 60px; background: #fdf8ed; border-radius: 24px; border: 1px solid #e8dbbd;"> | |
| <span style="font-size: 3rem;">📄</span> | |
| <h3 style="color: #b8860b;">File not found: {filename}</h3> | |
| <p style="color: #7a6a3e;">Please upload this file to your Space.</p> | |
| </div> | |
| """ | |
| except Exception as e: | |
| return f""" | |
| <div style="text-align: center; padding: 60px; background: #fdf8ed; border-radius: 24px;"> | |
| <h3 style="color: #b8860b;">Error loading {filename}</h3> | |
| <p style="color: #7a6a3e;">{str(e)}</p> | |
| </div> | |
| """ | |
| # Load your HTML files (they should be in the same directory as app.py) | |
| PROTOTYPE_HTML = load_html_file("BnParte-prototype.html") | |
| TECH_DOCS_HTML = load_html_file("BnParte-v1-Technical_Documentation.html") | |
| # ============================================================================ | |
| # Napoleon Quote Game Content (Same as before) | |
| # ============================================================================ | |
| NAPOLEON_QUOTES = [ | |
| "Victory belongs to the most persevering.", | |
| "Impossible is a word to be found only in the dictionary of fools.", | |
| "Courage isn't having the strength to go on; it is going on when you don't have strength.", | |
| "A leader is a dealer in hope.", | |
| "The battlefield is a scene of constant chaos. The winner will be the one who controls that chaos.", | |
| "Take time to deliberate, but when the time for action arrives, stop thinking and go in.", | |
| "Glory is fleeting, but obscurity is forever.", | |
| "There are only two forces that unite men — fear and interest.", | |
| "The art of government is not to let men grow stale.", | |
| "A throne is only a bench covered with velvet.", | |
| "Religion is excellent stuff for keeping common people quiet." | |
| ] | |
| HONEY_TIPS = [ | |
| "🐝 The queen bee never works alone – delegate and trust your team.", | |
| "🍯 Every great campaign is built from small, daily actions. Just like honey from nectar.", | |
| "⚔️ Napoleon's 'Corps d'armée' was a honeycomb of self-sufficient units. Structure your requirements similarly.", | |
| "👑 One Queen, one vision. Keep your strategic goal aligned across every cell of the hive.", | |
| "📡 Bee Stings are fast and decisive. Use alerts to catch risks early.", | |
| "🌻 The golden bee on Napoleon's coronation robe symbolized resurrection and industry – your projects can rise again." | |
| ] | |
| EAGLE_QUOTES = [ | |
| "🦅 The eagle does not catch flies. Focus on the strategic, not the trivial.", | |
| "🦅 Napoleon's eagle looked down from every flag – your dashboard should give you that high-altitude view.", | |
| "🦅 An eagle never fears the storm – it uses it to rise higher." | |
| ] | |
| def get_random_quote(): | |
| return (random.choice(NAPOLEON_QUOTES), random.choice(HONEY_TIPS), random.choice(EAGLE_QUOTES)) | |
| def update_display(): | |
| quote, honey, eagle = get_random_quote() | |
| timestamp = datetime.now().strftime("%H:%M:%S") | |
| return f""" | |
| <div style="font-family: 'Segoe UI', 'Playfair Display', serif; text-align: center; background: linear-gradient(135deg, #fffef7, #fdf8ed); border-radius: 32px; padding: 32px 24px; border: 1px solid #e8dbbd; box-shadow: 0 8px 24px rgba(0,0,0,0.05);"> | |
| <div style="font-size: 3rem; margin-bottom: 8px;">🐝⚜️🦅</div> | |
| <div style="font-size: 0.85rem; font-weight: 600; color: #b8860b; letter-spacing: 2px; text-transform: uppercase;">BnParte · Imperial Intelligence</div> | |
| <div style="font-size: 1.6rem; font-weight: 500; color: #2c3a2f; margin: 24px 16px; font-style: italic; line-height: 1.4;">“{quote}”</div> | |
| <div style="border-top: 2px solid #e8dbbd; width: 80px; margin: 16px auto;"></div> | |
| <div style="font-size: 0.95rem; color: #8b6914;">🍯 <strong>HoneyTip:</strong> {honey}</div> | |
| <div style="font-size: 0.85rem; margin-top: 12px; color: #a08438;">{eagle}</div> | |
| <div style="margin-top: 24px; font-size: 0.7rem; color: #b8a98b;">⚔️ Last update: {timestamp}</div> | |
| <div style="margin-top: 20px; background: #f5efe2; border-radius: 40px; padding: 10px 16px; display: inline-block; font-size: 0.75rem; color: #7a6a3e;"> | |
| 🚧 Full RAG-powered BA Dashboard <strong>under construction</strong> – new tokens & Gist being prepared. | |
| </div> | |
| </div> | |
| """ | |
| # ============================================================================ | |
| # Gradio App with Multiple Tabs | |
| # ============================================================================ | |
| # Custom light theme | |
| light_theme = gr.themes.Soft( | |
| primary_hue="amber", | |
| secondary_hue="stone", | |
| neutral_hue="gray", | |
| font=gr.themes.GoogleFont("Inter"), | |
| ).set( | |
| body_background_fill="*neutral_50", | |
| block_background_fill="white", | |
| ) | |
| with gr.Blocks(title="BnParte – BA Command Center", theme=light_theme) as demo: | |
| gr.HTML(""" | |
| <div style="text-align: center; margin-bottom: 16px; padding-top: 8px;"> | |
| <h1 style="font-family: 'Playfair Display', serif; font-size: 2.5rem; background: linear-gradient(135deg, #b8860b, #d4af37, #f5e7b2); background-clip: text; -webkit-background-clip: text; color: transparent; margin-bottom: 4px;">⚔️ BnParte ⚔️</h1> | |
| <p style="color: #8a7a5a; font-size: 0.9rem;">Napoleon-inspired Strategic Command Center</p> | |
| </div> | |
| """) | |
| # Create tabs | |
| with gr.Tabs(): | |
| # Tab 1: Interactive Teaser (Napoleon Quotes Game) | |
| with gr.TabItem("🐝 Interactive Teaser"): | |
| quote_display = gr.HTML(value=update_display()) | |
| refresh_btn = gr.Button("🐝 New Napoleonic Insight", variant="primary", size="lg") | |
| refresh_btn.click(fn=update_display, outputs=quote_display) | |
| gr.Markdown(""" | |
| --- | |
| ### 🚧 What's being built? | |
| - **RAG-powered knowledge base** – ingest documents, transcripts, chats | |
| - **Hive Mind dashboard** – AI extracts risks, decisions, action items | |
| - **Daily chatter feed** – one-liners from team and leadership | |
| - **Bee Stings alerts** & **HoneyTips** contextual suggestions | |
| - **Kanban + Timeline** integrated with vector search | |
| > Full version coming soon with ChromaDB + Groq + GitHub Gist sync. | |
| """) | |
| # Tab 2: Prototype Mockup (Your HTML wireframe) | |
| with gr.TabItem("📊 Prototype Dashboard"): | |
| gr.HTML(PROTOTYPE_HTML) | |
| # Tab 3: Technical Documentation | |
| with gr.TabItem("📘 Technical Documentation"): | |
| gr.HTML(TECH_DOCS_HTML) | |
| # Footer | |
| gr.HTML(""" | |
| <div style="text-align: center; margin-top: 24px; padding: 16px; font-size: 0.7rem; color: #b8a98b; border-top: 1px solid #f0e8d8;"> | |
| Built with ❤️ and ☀️ by <strong>Sai Varakala</strong> · Techno‑Agilist · Scrum Master @ TCS<br> | |
| © 2026 · MIT License · Inspired by Napoleon's golden bee and the eagle of victory. | |
| </div> | |
| """) | |
| if __name__ == "__main__": | |
| demo.launch() |