Download app.py from powercoreai/quantum-wizard-council-fixed: direct link, hf CLI and curl.
- Browser
- Download file 13.9 kB
-
https://huggingface.co/powercoreai/quantum-wizard-council-fixed/resolve/main/app.py
- Command line
-
hf download hf://powercoreai/quantum-wizard-council-fixed/app.py
-
curl -L -o app.py https://huggingface.co/powercoreai/quantum-wizard-council-fixed/resolve/main/app.py
13.9 kB
| import gradio as gr | |
| import json | |
| import time | |
| import random | |
| from typing import List, Dict, Any | |
| import os | |
| # Mock Quantum Wizard components for demo | |
| class MockQuantumWizard: | |
| def __init__(self): | |
| self.session_id = "demo_session" | |
| self.ideas = [] | |
| self.council_members = [ | |
| "STRATEGIST", "INNOVATOR", "CRITIC", "ARCHITECT", "ALCHEMIST" | |
| ] | |
| self.token_balance = { | |
| "chaos": 50, | |
| "council": 25, | |
| "orbit": 100, | |
| "premium": 10 | |
| } | |
| def run_council_analysis(self, idea: str) -> Dict[str, Any]: | |
| """Mock council analysis""" | |
| analysis = { | |
| "STRATEGIST": { | |
| "analysis": f"Market Analysis: {idea} targets a $2.4B market with 15% annual growth. Key competitors include established players in the space.", | |
| "concerns": "Market saturation, Customer acquisition cost", | |
| "opportunities": "AI integration trend, Remote work adoption", | |
| "confidence": 0.85 | |
| }, | |
| "INNOVATOR": { | |
| "analysis": f"Innovation Angle: {idea} could leverage GPT-4 for intelligent processing, ML clustering for pattern recognition, and voice-to-text for seamless capture.", | |
| "tech_stack": "Python/FastAPI backend, React frontend, OpenAI API, Vector embeddings", | |
| "confidence": 0.92 | |
| }, | |
| "CRITIC": { | |
| "analysis": f"Risk Assessment: {idea} faces challenges with user adoption (new habit formation), data privacy concerns, and feature creep.", | |
| "risk_factors": "Poor onboarding, Complex UX, Insufficient differentiation", | |
| "success_rate": "23% for similar apps", | |
| "confidence": 0.78 | |
| }, | |
| "ARCHITECT": { | |
| "analysis": f"Technical Architecture: {idea} requires scalable document processing, real-time sync, and AI inference. Recommended: microservices with event-driven architecture.", | |
| "confidence": 0.88 | |
| }, | |
| "ALCHEMIST": { | |
| "analysis": f"Synergy Opportunities: {idea} could integrate with Slack, Google Workspace, Notion API. Potential partnerships with productivity influencers.", | |
| "confidence": 0.81 | |
| } | |
| } | |
| return analysis | |
| def trigger_chaos_injection(self, idea: str, intensity: float) -> List[Dict[str, Any]]: | |
| """Mock chaos injection""" | |
| mutations = [ | |
| "reversal", "amplification", "domain_shift", "constraint_addition", | |
| "metaphor_injection", "scale_transformation", "perspective_shift", "wild_tangent" | |
| ] | |
| num_forks = max(1, int(intensity * 5)) | |
| results = [] | |
| for i in range(num_forks): | |
| mutation = mutations[i % len(mutations)] | |
| if mutation == "reversal": | |
| new_idea = f"What if we did the opposite of '{idea}'?" | |
| elif mutation == "amplification": | |
| new_idea = f"'{idea}' but 10x bigger and more powerful" | |
| elif mutation == "domain_shift": | |
| domains = ["gaming", "healthcare", "education", "finance", "entertainment"] | |
| domain = domains[i % len(domains)] | |
| new_idea = f"'{idea}' applied to {domain}" | |
| elif mutation == "constraint_addition": | |
| constraints = ["for mobile only", "in under 60 seconds", "without internet", "using only voice"] | |
| constraint = constraints[i % len(constraints)] | |
| new_idea = f"'{idea}' but {constraint}" | |
| else: | |
| new_idea = f"A creative variation of '{idea}' with chaos intensity {intensity}" | |
| results.append({ | |
| "idea": new_idea, | |
| "mutation_type": mutation, | |
| "temperature": 0.8 + (intensity * 0.4), | |
| "confidence": 0.5 + (intensity * 0.3), | |
| "rarity": random.choice(["Common", "Rare", "Epic", "Legendary"]) | |
| }) | |
| return results | |
| def tick_orbit(self) -> List[Dict[str, Any]]: | |
| """Mock orbit ticking""" | |
| if not self.ideas: | |
| return [] | |
| # Simulate idea evolution | |
| evolved_ideas = [] | |
| for idea in self.ideas[-3:]: # Last 3 ideas | |
| evolution = random.choice([ | |
| "gained energy", "spawned variation", "merged with another idea", "triggered burst" | |
| ]) | |
| evolved_ideas.append({ | |
| "original_idea": idea, | |
| "evolution": evolution, | |
| "energy_level": random.uniform(0.1, 1.0), | |
| "timestamp": time.time() | |
| }) | |
| return evolved_ideas | |
| # Initialize mock system | |
| qw = MockQuantumWizard() | |
| def format_council_analysis(analysis: Dict[str, Any]) -> str: | |
| """Format council analysis for display""" | |
| formatted = "" | |
| for role, data in analysis.items(): | |
| formatted += f"## π§ββοΈ {role}\n\n" | |
| formatted += f"**Analysis:** {data['analysis']}\n\n" | |
| if 'concerns' in data: | |
| formatted += f"**Concerns:** {data['concerns']}\n\n" | |
| if 'opportunities' in data: | |
| formatted += f"**Opportunities:** {data['opportunities']}\n\n" | |
| if 'tech_stack' in data: | |
| formatted += f"**Tech Stack:** {data['tech_stack']}\n\n" | |
| if 'risk_factors' in data: | |
| formatted += f"**Risk Factors:** {data['risk_factors']}\n\n" | |
| if 'success_rate' in data: | |
| formatted += f"**Success Rate:** {data['success_rate']}\n\n" | |
| formatted += f"**Confidence:** {data['confidence']:.0%}\n\n" | |
| formatted += "---\n\n" | |
| return formatted | |
| def format_chaos_results(results: List[Dict[str, Any]]) -> str: | |
| """Format chaos injection results for display""" | |
| formatted = f"## πͺοΈ CHAOS INJECTION RESULTS ({len(results)} variations)\n\n" | |
| for i, result in enumerate(results, 1): | |
| rarity_emoji = { | |
| "Common": "βͺ", | |
| "Rare": "π΅", | |
| "Epic": "π£", | |
| "Legendary": "π‘" | |
| }.get(result['rarity'], "βͺ") | |
| formatted += f"### {rarity_emoji} Variation {i}: {result['mutation_type'].title()}\n\n" | |
| formatted += f"**Idea:** {result['idea']}\n\n" | |
| formatted += f"**Temperature:** {result['temperature']:.2f}\n" | |
| formatted += f"**Confidence:** {result['confidence']:.0%}\n" | |
| formatted += f"**Rarity:** {result['rarity']}\n\n" | |
| formatted += "---\n\n" | |
| return formatted | |
| def run_demo(idea: str, action: str, intensity: float = 0.5) -> tuple: | |
| """Main demo function""" | |
| if not idea.strip(): | |
| return "Please enter an idea to analyze!", "", "" | |
| # Add idea to orbit | |
| qw.ideas.append(idea) | |
| output = f"# π§ββοΈ QUANTUM WIZARD V2 DEMO\n\n" | |
| output += f"**Session ID:** {qw.session_id}\n" | |
| output += f"**Input Idea:** {idea}\n\n" | |
| if action == "Council Analysis": | |
| # Run council analysis | |
| analysis = qw.run_council_analysis(idea) | |
| output += format_council_analysis(analysis) | |
| # Update token balance | |
| qw.token_balance["council"] -= 1 | |
| elif action == "Chaos Injection": | |
| # Run chaos injection | |
| results = qw.trigger_chaos_injection(idea, intensity) | |
| output += format_chaos_results(results) | |
| # Update token balance | |
| qw.token_balance["chaos"] -= 2 | |
| elif action == "Tick Orbit": | |
| # Tick the orbit | |
| evolved = qw.tick_orbit() | |
| if evolved: | |
| output += "## π ORBIT EVOLUTION\n\n" | |
| for evolution in evolved: | |
| output += f"**{evolution['original_idea']}** β {evolution['evolution']}\n" | |
| output += f"Energy Level: {evolution['energy_level']:.2f}\n\n" | |
| else: | |
| output += "## π ORBIT STATUS\n\nNo ideas in orbit to evolve.\n\n" | |
| # Update token balance | |
| qw.token_balance["orbit"] -= 1 | |
| # Add token balance | |
| output += f"## π° TOKEN BALANCE\n\n" | |
| output += f"Chaos: {qw.token_balance['chaos']} | " | |
| output += f"Council: {qw.token_balance['council']} | " | |
| output += f"Orbit: {qw.token_balance['orbit']} | " | |
| output += f"Premium: {qw.token_balance['premium']}\n\n" | |
| # Add session info | |
| output += f"## π SESSION INFO\n\n" | |
| output += f"Total Ideas: {len(qw.ideas)}\n" | |
| output += f"Actions Performed: {action}\n" | |
| output += f"Session Duration: {time.strftime('%H:%M:%S')}\n\n" | |
| # Create JSON output for API simulation | |
| json_output = { | |
| "session_id": qw.session_id, | |
| "input_idea": idea, | |
| "action": action, | |
| "intensity": intensity, | |
| "token_balance": qw.token_balance, | |
| "ideas_count": len(qw.ideas), | |
| "timestamp": time.time() | |
| } | |
| # Create analytics output | |
| analytics = f"## π ANALYTICS\n\n" | |
| analytics += f"**User Engagement:** High\n" | |
| analytics += f"**Feature Usage:** {action}\n" | |
| analytics += f"**Token Efficiency:** {random.randint(70, 95)}%\n" | |
| analytics += f"**Idea Quality Score:** {random.randint(60, 90)}/100\n" | |
| analytics += f"**Retention Probability:** {random.randint(80, 95)}%\n\n" | |
| return output, json.dumps(json_output, indent=2), analytics | |
| # Create Gradio interface | |
| with gr.Blocks( | |
| title="π§ββοΈ Quantum Wizard V2 - AI Ideation System", | |
| theme=gr.themes.Soft(), | |
| css=""" | |
| .gradio-container { | |
| max-width: 1200px !important; | |
| } | |
| .token-balance { | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| padding: 10px; | |
| border-radius: 8px; | |
| color: white; | |
| margin: 10px 0; | |
| } | |
| """ | |
| ) as demo: | |
| gr.Markdown(""" | |
| # π§ββοΈ QUANTUM WIZARD V2 - AI IDEATION SYSTEM | |
| **Transform any idea into a business plan in 5 minutes with AI-powered analysis and creative variations.** | |
| This demo showcases the core features of Quantum Wizard V2: | |
| - **Wizard Council Analysis**: Get expert perspectives from 5 AI specialists | |
| - **Chaos Injection**: Generate creative variations with controlled randomness | |
| - **Quantum Orbit**: Watch ideas evolve and spawn new concepts | |
| - **Token Economics**: Experience the monetization system | |
| --- | |
| """) | |
| with gr.Row(): | |
| with gr.Column(scale=2): | |
| idea_input = gr.Textbox( | |
| label="π‘ Enter Your Business Idea", | |
| placeholder="e.g., A productivity app that uses AI to organize thoughts", | |
| lines=3 | |
| ) | |
| with gr.Row(): | |
| action_dropdown = gr.Dropdown( | |
| choices=["Council Analysis", "Chaos Injection", "Tick Orbit"], | |
| value="Council Analysis", | |
| label="π― Choose Action" | |
| ) | |
| intensity_slider = gr.Slider( | |
| minimum=0.1, | |
| maximum=1.0, | |
| value=0.5, | |
| step=0.1, | |
| label="πͺοΈ Chaos Intensity" | |
| ) | |
| run_button = gr.Button("π Run Quantum Wizard", variant="primary", size="lg") | |
| with gr.Column(scale=1): | |
| gr.Markdown(""" | |
| ## π° TOKEN SYSTEM | |
| **Starter Package ($197):** | |
| - 100 Chaos Tokens | |
| - 50 Council Tokens | |
| - 200 Orbit Tokens | |
| **Creator Package ($397):** | |
| - 500 Chaos Tokens | |
| - 250 Council Tokens | |
| - 1000 Orbit Tokens | |
| - Analytics & Stripe Integration | |
| **Wizard Package ($697):** | |
| - Unlimited Tokens | |
| - All Features | |
| - White-label Rights | |
| - TAAFT Submission Package | |
| --- | |
| ## π― QUICK START | |
| 1. Enter your business idea | |
| 2. Choose an action (Council/Chaos/Orbit) | |
| 3. Adjust intensity for chaos injection | |
| 4. Click "Run Quantum Wizard" | |
| 5. Review the AI analysis and variations | |
| --- | |
| ## π READY TO LAUNCH? | |
| Get the complete system with: | |
| - Full source code | |
| - Stripe integration | |
| - Analytics dashboard | |
| - Deployment automation | |
| - TAAFT submission package | |
| **Available on Gumroad starting at $197** | |
| """) | |
| with gr.Row(): | |
| with gr.Column(scale=2): | |
| output_markdown = gr.Markdown(label="π Analysis Results") | |
| with gr.Column(scale=1): | |
| json_output = gr.JSON(label="π§ API Response") | |
| analytics_output = gr.Markdown(label="π Analytics") | |
| # Example ideas | |
| gr.Markdown(""" | |
| ## π‘ EXAMPLE IDEAS TO TRY | |
| - "A social media app for pet owners" | |
| - "AI-powered meal planning service" | |
| - "Virtual reality therapy platform" | |
| - "Blockchain-based freelance marketplace" | |
| - "Smart home energy optimization system" | |
| """) | |
| # Connect the interface | |
| run_button.click( | |
| fn=run_demo, | |
| inputs=[idea_input, action_dropdown, intensity_slider], | |
| outputs=[output_markdown, json_output, analytics_output] | |
| ) | |
| # Launch the app | |
| if __name__ == "__main__": | |
| demo.launch() |