| from flask import Flask, request, jsonify |
| import requests |
| import threading |
| import time |
| from datetime import datetime |
| import os |
|
|
| |
| GROQ_KEY = "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" |
| OPENROUTER_KEY = "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" |
| os.environ["GROQ_API_KEY"] = GROQ_KEY |
|
|
| app = Flask(__name__) |
| VERCEL = "https://ai-ivory-delta.vercel.app" |
|
|
| stats = {"sites": 0, "deployed": 0, "started": datetime.now().isoformat()} |
| logs = [] |
| running = False |
|
|
| def add_log(msg): |
| logs.append(f"[{datetime.now().strftime('%H:%M:%S')}] {msg}") |
| if len(logs) > 50: logs.pop(0) |
|
|
| def call_best_ai(prompt): |
| """Try ALL free models via OpenRouter""" |
| models = [ |
| ("google/gemini-2.0-flash-001", "Gemini"), |
| ("anthropic/claude-3-haiku", "Claude"), |
| ("deepseek/deepseek-r1", "DeepSeek"), |
| ("meta-llama/llama-3.3-70b-instruct", "Llama"), |
| ("mistralai/mistral-7b-instruct", "Mistral"), |
| ] |
| for model_id, name in models: |
| try: |
| r = requests.post("https://openrouter.ai/api/v1/chat/completions", |
| headers={"Authorization": f"Bearer {OPENROUTER_KEY}", "Content-Type": "application/json"}, |
| json={"model": model_id, "max_tokens": 8000, "temperature": 0.3, |
| "messages": [{"role": "system", "content": "You are an elite web developer. Return complete HTML with premium dark theme design."}, |
| {"role": "user", "content": prompt}]}, timeout=300) |
| if r.ok: |
| html = r.json()["choices"][0]["message"]["content"] |
| if html and len(html) > 500: |
| add_log(f"โ
{name}") |
| if "```html" in html: |
| html = html.split("```html")[-1].split("```")[0] |
| return html |
| except: pass |
| return "" |
| |
|
|
| def get_design_rules(): |
| return """DESIGN RULES: |
| - Dark background #0A0A0F โ NEVER white |
| - Orange #FF6B00 accent on headings, buttons, icons |
| - Bebas Neue (headings) + DM Sans (body) + Space Mono (labels) from Google Fonts CDN |
| - Cards: #111118, 14px radius, #2A2A38 border, orange top accent line |
| - Hero: gradient background with radial glow |
| - Stats: Bebas Neue 48px orange numbers |
| - Buttons: Space Mono bold, orange primary |
| - Font Awesome 6 CDN icons |
| - Real Hindi+English content, Indian names, NO Lorem Ipsum |
| - Mobile responsive""" |
|
|
| |
|
|
| @app.route("/api/build-premium", methods=["POST"]) |
| def build_premium(): |
| data = request.json |
| niche = data.get("niche", "AI Tools") |
| site_type = data.get("type", "website") |
| add_log(f"โจ Premium: {niche}") |
| |
| extras = { |
| "movie": """MOVIE WEBSITE - CRITICAL INSTRUCTIONS: |
| |
| YOU MUST INCLUDE 50 MOVIES MINIMUM in a responsive grid. |
| |
| FOR EVERY SINGLE MOVIE CARD, you MUST include this EXACT YouTube embed code: |
| <iframe width='100%' height='200' src='https://www.youtube.com/embed/VIDEO_ID' frameborder='0' allowfullscreen style='border-radius:10px;'></iframe> |
| |
| USE THESE EXACT 50 MOVIES with YouTube IDs: |
| Deadpool 3(ztLkQZx1HMsโญ8.5), Dune 2(Way9Dexny3wโญ9.0), Godzilla x Kong(lV1OOlGw3FMโญ7.8), Kung Fu Panda 4(_inKs4eeHiIโญ7.2), Furiosa(XJMuhwV6cA4โญ8.0), Inside Out 2(LAfT8Mn3pcโญ8.3), Avatar 3, Avengers Secret Wars, Spider-Man 4, Superman Legacy, Fantastic Four, Blade, Thunderbolts, Captain America 4, Joker 2, Venom 3, Bad Boys 4, Despicable Me 4, Sonic 3, Mufasa, Kraven, Madame Web, Aquaman 2, Transformers 8, Fast Furious 11, Mission Impossible 8, John Wick 5, Extraction 3, The Equalizer 4, Alien Romulus, A Quiet Place 3, Scream 7, Saw 11, The Conjuring 4, Ghostbusters 5, Beetlejuice 2, Twisters, Gladiator 2, Wicked, Wonka 2, Minecraft Movie, Borderlands, Mortal Kombat 2, Street Fighter, Resident Evil, Silent Hill, Five Nights at Freddys 2, The Crow, Snow White, Moana 2, Mufasa The Lion King. |
| |
| EVERY CARD MUST HAVE: |
| 1. The YouTube embed iframe above |
| 2. Movie name in Hindi + English |
| 3. โญ IMDB rating |
| 4. Genre tags |
| 5. "Watch Full Movie" button linking to: https://www.youtube.com/results?search_query=MOVIE_NAME+hindi+dubbed+full+movie |
| 6. Hindi description (2 lines) |
| |
| Include: Working search bar, Category filters (All, Action, Sci-Fi, Horror, Comedy, Animation). |
| |
| CRITICAL: The YouTube iframe MUST be present in EVERY movie card. This is non-negotiable.""", |
|
|
| "game": """GAMING WEBSITE with 20 games: |
| Games: Free Fire Max, BGMI, GTA 6, Minecraft, PUBG Mobile, Call of Duty Mobile, Clash of Clans, Subway Surfers, Temple Run, Candy Crush, Asphalt 9, FIFA Mobile, GTA 5, Valorant, Fortnite, Among Us, Roblox, Apex Legends, Clash Royale, eFootball. |
| Each card: Game name+emoji, category, download size, โญ rating, Hindi description, "Download Guide" button, "Tips & Tricks" button. |
| Include: Category filters, "How to Download" steps, Latest News section.""", |
|
|
| "tool": """TOOLS WEBSITE with REAL working JavaScript tools: |
| Build 3-4 WORKING tools: Calculator, Converter, Generator, or Resizer. |
| Each tool must have REAL JavaScript that actually works when user interacts. |
| Include: Tool name, description, working input/output.""", |
|
|
| "smm": """SMM PANEL with real services: |
| Services: Instagram Followers(โน199), Instagram Likes(โน49), YouTube Views(โน149), YouTube Subscribers(โน299), Facebook Likes(โน79), Twitter Followers(โน149), Telegram Members(โน99), WhatsApp Channel(โน129). |
| Each: Platform icon, service name, price, min-max, "Order Now" button. |
| Include: How It Works, Payment methods, Live order counter, FAQ.""", |
|
|
| "news": """NEWS WEBSITE auto-updating: |
| Include: Latest news section, category filters (India, World, Tech, Sports, Entertainment), trending topics, search bar. |
| Design news cards with title, image placeholder, category tag, time, summary.""", |
|
|
| "education": """EDUCATION WEBSITE for Indian students: |
| Subjects: UPSC, SSC, Banking, Railway, NEET, JEE. |
| Each: Study material, PDF links, YouTube video embeds, quiz section. |
| Include: Subject filters, search, "Download Notes" buttons.""", |
|
|
| "finance": """FINANCE TOOLS WEBSITE: |
| Tools: Income Tax Calculator(working JS), EMI Calculator(working JS), SIP Calculator, GST Calculator, Salary Calculator. |
| Each: Input fields, calculate button, result display with charts. |
| Include: Financial tips blog section.""", |
|
|
| "sports": """SPORTS WEBSITE for Indian audience: |
| Cricket: Live score section, IPL 2025, Team India schedule. |
| Football: FIFA World Cup, ISL. |
| Include: Score cards, match schedule, news updates.""", |
|
|
| "music": """MUSIC WEBSITE: |
| Bollywood songs, Devotional, Punjabi, Latest hits. |
| Each: Song name, artist, YouTube embed player, download link. |
| Include: Genre filters, search, Top 20 chart.""", |
|
|
| "apps": """APPS/MODS WEBSITE: |
| Apps: GB WhatsApp, Instagram Pro, YouTube Vanced, Spotify Mod, Netflix Mod, CapCut Pro, PicsArt Gold, Kinemaster Mod, Free Fire Mod, BGMI Mod. |
| Each: App icon, name, version, size, features list, "Download" button. |
| Include: Category filters, "How to Install" guide, FAQ.""" |
| } |
| |
| prompt = f"""Build a PREMIUM {site_type.upper()} WEBSITE for: {niche}. |
| {get_design_rules()} |
| {extras.get(site_type, "Premium website with all sections.")} |
| SECTIONS: Nav, Hero, Stats(4), Items Grid, Testimonials(3 Indian), FAQ(8), Contact, Footer. |
| Return COMPLETE HTML: <!DOCTYPE html>, CSS in <style>, JS in <script>.""" |
|
|
| html = call_best_ai(prompt) |
| if html: |
| stats["sites"] += 1 |
| return jsonify({"success": True, "website": html, "size": len(html), "type": site_type}) |
| return jsonify({"success": False, "error": "All AIs failed"}) |
|
|
| @app.route("/api/build-pro-site", methods=["POST"]) |
| def build_pro_site(): |
| data = request.json |
| niche = data.get("niche", "AI Tools") |
| add_log(f"PRO: {niche}") |
| prompt = f"Build a premium website for {niche}. {get_design_rules()} All sections. Real content. Return HTML." |
| html = call_best_ai(prompt) |
| if html: |
| stats["sites"] += 1 |
| return jsonify({"success": True, "website": html, "size": len(html)}) |
| return jsonify({"success": False, "error": "Failed"}) |
|
|
| @app.route("/api/build-website", methods=["POST"]) |
| def build_website(): |
| data = request.json |
| niche = data.get("niche", "AI Tools") |
| try: |
| r = requests.post(f"{VERCEL}/api/website-empire", json={"action": "build-site", "niche": niche}, timeout=180) |
| d = r.json() |
| if d.get("success"): |
| stats["sites"] += 1 |
| return jsonify({"success": True, "website": d.get("website", ""), "size": len(d.get("website", ""))}) |
| return jsonify({"success": False, "error": d.get("error")}) |
| except Exception as e: |
| return jsonify({"success": False, "error": str(e)}) |
|
|
| @app.route("/api/deploy", methods=["POST"]) |
| def deploy(): |
| data = request.json |
| html = data.get("html", "") |
| niche = data.get("niche", "website") |
| if not html: return jsonify({"success": False}) |
| stats["deployed"] += 1 |
| return jsonify({"success": True, "url": f"https://{niche.replace(' ','-').lower()[:30]}.vercel.app", "steps": ["Download HTML", "Go to vercel.com/new", "Drag & drop", "LIVE!"]}) |
|
|
| @app.route("/api/stats") |
| def get_stats(): return jsonify(stats) |
|
|
| @app.route("/api/logs") |
| def get_logs(): return jsonify({"logs": logs[-30:]}) |
|
|
| @app.route("/api/start-auto", methods=["POST"]) |
| def start_auto(): |
| global running |
| if not running: |
| running = True |
| threading.Thread(target=auto_loop, daemon=True).start() |
| return jsonify({"status": "started"}) |
| return jsonify({"status": "already_running"}) |
|
|
| def auto_loop(): |
| global running |
| niches = [ |
| ("Hollywood Movies Hindi", "movie"), ("Free Fire Guide", "game"), |
| ("Tax Calculator India", "tool"), ("SMM Panel India", "smm"), |
| ("Today News Hindi", "news"), ("UPSC Study Material", "education"), |
| ("EMI Calculator", "finance"), ("IPL 2025 Live Score", "sports"), |
| ("Bollywood Songs", "music"), ("GB WhatsApp Download", "apps"), |
| ] |
| while running: |
| for niche, stype in niches: |
| if not running: break |
| try: |
| r = requests.post("http://127.0.0.1:7860/api/build-premium", json={"niche": niche, "type": stype}, timeout=300) |
| if r.json().get("success"): stats["sites"] += 1 |
| except: pass |
| time.sleep(30) |
|
|
| @app.route("/") |
| def home(): |
| return """ |
| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>AI Empire Brain 2070</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <style> |
| * { margin:0; padding:0; box-sizing:border-box; } |
| body { background:#0A0A0F; color:#E8E8F0; font-family:Arial; min-height:100vh; } |
| .header { background:linear-gradient(135deg,#1a0033,#0a0a2e); padding:20px; text-align:center; border-bottom:2px solid #2A2A38; } |
| h1 { font-size:clamp(22px,5vw,36px); background:linear-gradient(to right,#FF6B00,#FF00FF,#00AAFF); -webkit-background-clip:text; -webkit-text-fill-color:transparent; } |
| .stats { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; padding:12px; } |
| .stat { background:#111118; padding:10px; border-radius:8px; text-align:center; border:1px solid #2A2A38; } |
| .stat p { font-size:20px; font-weight:bold; color:#FF6B00; } |
| .stat h3 { color:#5A5A70; font-size:8px; text-transform:uppercase; } |
| .container { max-width:750px; margin:0 auto; padding:12px; } |
| input { width:100%; padding:12px; border-radius:8px; border:1px solid #2A2A38; background:#111118; color:white; font-size:14px; margin-bottom:6px; } |
| button { width:100%; padding:12px; border-radius:8px; border:none; font-size:13px; font-weight:bold; cursor:pointer; margin-bottom:5px; } |
| .btn-movie { background:linear-gradient(135deg,#FF0000,#FF6B00); color:white; } |
| .btn-game { background:linear-gradient(135deg,#00AAFF,#9B6BFF); color:white; } |
| .btn-tool { background:linear-gradient(135deg,#00D46A,#00AAFF); color:black; } |
| .btn-smm { background:linear-gradient(135deg,#E91E63,#9C27B0); color:white; } |
| .btn-news { background:linear-gradient(135deg,#FF9800,#FF5722); color:white; } |
| .btn-edu { background:linear-gradient(135deg,#4CAF50,#8BC34A); color:black; } |
| .btn-fin { background:linear-gradient(135deg,#2196F3,#03A9F4); color:white; } |
| .btn-sport { background:linear-gradient(135deg,#F44336,#FF9800); color:white; } |
| .btn-music { background:linear-gradient(135deg,#9C27B0,#E91E63); color:white; } |
| .btn-apps { background:linear-gradient(135deg,#607D8B,#37474F); color:white; } |
| .btn-pro { background:linear-gradient(135deg,#FFD700,#FF6B00); color:black; } |
| .btn-basic { background:linear-gradient(135deg,#00D46A,#4FA3FF); color:black; } |
| .btn-deploy { background:#4FA3FF; color:white; } |
| .btn-red { background:#FF3B5C; color:white; } |
| .result { background:#111118; padding:12px; border-radius:8px; margin-top:8px; white-space:pre-wrap; font-size:12px; max-height:400px; overflow-y:auto; border:1px solid #2A2A38; } |
| iframe { width:100%; height:400px; border:1px solid #333; border-radius:8px; margin-top:8px; background:white; display:none; } |
| </style> |
| </head> |
| <body> |
| <div class="header"><h1>๐ง AI EMPIRE BRAIN 2070</h1><p style="color:#5A5A70;font-size:11px;">10 Website Types | Claude + DeepSeek + Gemini | OpenRouter</p></div> |
| <div class="stats"> |
| <div class="stat"><h3>๐ Built</h3><p id="site-count">0</p></div> |
| <div class="stat"><h3>๐ Deploy</h3><p id="deploy-count">0</p></div> |
| <div class="stat"><h3>๐ค AIs</h3><p>3</p></div> |
| <div class="stat"><h3>๐ Types</h3><p>10</p></div> |
| </div> |
| <div class="container"> |
| <input id="niche" placeholder="Enter niche..."> |
| <button class="btn-movie" onclick="build('movie')">๐ฌ MOVIES (50+ Trailers)</button> |
| <button class="btn-game" onclick="build('game')">๐ฎ GAMING (20 Games)</button> |
| <button class="btn-tool" onclick="build('tool')">๐ ๏ธ TOOLS (Working JS)</button> |
| <button class="btn-smm" onclick="build('smm')">๐ฅ SMM PANEL</button> |
| <button class="btn-news" onclick="build('news')">๐ฐ NEWS SITE</button> |
| <button class="btn-edu" onclick="build('education')">๐ EDUCATION</button> |
| <button class="btn-fin" onclick="build('finance')">๐ฐ FINANCE TOOLS</button> |
| <button class="btn-sport" onclick="build('sports')">๐ SPORTS</button> |
| <button class="btn-music" onclick="build('music')">๐ต MUSIC</button> |
| <button class="btn-apps" onclick="build('apps')">๐ฑ APPS/MODS</button> |
| <button class="btn-pro" onclick="buildPro()">๐ข PRO SITE</button> |
| <button class="btn-basic" onclick="buildBasic()">๐ BASIC</button> |
| <button class="btn-deploy" onclick="deploySite()">๐ DEPLOY TO LIVE URL</button> |
| <button class="btn-red" onclick="startAuto()">โก AUTO-PILOT 24/7</button> |
| <div id="result" class="result">โจ 10 website types! Choose one and build with Claude + DeepSeek + Gemini!</div> |
| </div> |
| <script> |
| const API = window.location.origin; |
| let currentWebsite = ''; |
| |
| async function build(type) { |
| const n = document.getElementById('niche').value || getDefaultNiche(type); |
| document.getElementById('result').innerHTML = 'โณ Building premium ' + type + ' site...'; |
| const r = await fetch(API+'/api/build-premium', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({niche:n, type:type})}); |
| showResult(await r.json()); |
| } |
| |
| function getDefaultNiche(type) { |
| const defaults = {movie:'Hollywood Movies Hindi Dubbed',game:'Mobile Games Download',tool:'Free Online Tools',smm:'SMM Panel India',news:'Today News Hindi',education:'UPSC Study Material',finance:'Income Tax Calculator',sports:'IPL Live Score 2025',music:'Bollywood Songs 2025',apps:'GB WhatsApp Download'}; |
| return defaults[type] || 'AI Tools'; |
| } |
| |
| async function buildPro() { |
| const n = document.getElementById('niche').value || 'AI Tools'; |
| document.getElementById('result').innerHTML = '๐ข Building PRO...'; |
| const r = await fetch(API+'/api/build-pro-site', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({niche:n})}); |
| showResult(await r.json()); |
| } |
| |
| async function buildBasic() { |
| const n = document.getElementById('niche').value || 'AI Tools'; |
| document.getElementById('result').innerHTML = '๐ Building...'; |
| const r = await fetch(API+'/api/build-website', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({niche:n})}); |
| showResult(await r.json()); |
| } |
| |
| function showResult(d) { |
| if(d.success) { |
| currentWebsite = d.website; |
| document.getElementById('result').innerHTML = 'โ
BUILT! Size: '+d.size+' chars | Type: '+(d.type||'website')+'<br><br>'+ |
| '<button onclick="preview()" style="background:#4FA3FF;color:white;padding:10px;border-radius:8px;border:none;cursor:pointer;">๐๏ธ Preview</button> '+ |
| '<button onclick="downloadSite()" style="background:#FFD700;color:black;padding:10px;border-radius:8px;border:none;cursor:pointer;">๐ฅ Download</button> '+ |
| '<button onclick="showCode()" style="background:#00D46A;color:black;padding:10px;border-radius:8px;border:none;cursor:pointer;">๐ Show Code</button>'+ |
| '<br><iframe id="pf"></iframe>'+ |
| '<textarea id="codeArea" style="width:100%;height:300px;background:#000;color:#0f0;font-size:11px;margin-top:10px;display:none;" onclick="this.select()"></textarea>'; |
| } else { |
| document.getElementById('result').innerHTML = 'โ '+ (d.error || 'Failed'); |
| } |
| updateStats(); |
| } |
| |
| function preview() { const f=document.getElementById('pf'); f.style.display=f.style.display==='none'?'block':'none'; if(f.style.display==='block') f.srcdoc=currentWebsite; } |
| |
| function downloadSite() { |
| const blob = new Blob([currentWebsite], {type:'text/html'}); |
| const url = URL.createObjectURL(blob); |
| const a = document.createElement('a'); |
| a.href = url; a.download = 'website.html'; |
| document.body.appendChild(a); a.click(); |
| document.body.removeChild(a); URL.revokeObjectURL(url); |
| } |
| |
| function showCode() { |
| const ta = document.getElementById('codeArea'); |
| if (ta.style.display === 'none') { |
| ta.style.display = 'block'; ta.value = currentWebsite; ta.select(); |
| } else { ta.style.display = 'none'; } |
| } |
| |
| async function deploySite() { |
| if(!currentWebsite) { alert('Build first!'); return; } |
| const n = document.getElementById('niche').value || 'website'; |
| const r = await fetch(API+'/api/deploy', {method:'POST', headers:{'Content-Type':'application/json'}, body:JSON.stringify({html:currentWebsite, niche:n})}); |
| const d = await r.json(); |
| document.getElementById('result').innerHTML = d.success ? 'โ
Ready!<br><b>'+d.url+'</b><br>'+d.steps.join('<br>') : 'โ Failed'; |
| } |
| |
| async function startAuto() { |
| await fetch(API+'/api/start-auto',{method:'POST'}); |
| document.getElementById('status-text').innerHTML='RUNNING'; |
| document.getElementById('status-text').style.color='#00D46A'; |
| } |
| |
| async function updateStats() { |
| const r=await fetch(API+'/api/stats'); const d=await r.json(); |
| document.getElementById('site-count').innerHTML=d.sites||0; |
| document.getElementById('deploy-count').innerHTML=d.deployed||0; |
| } |
| updateStats(); |
| </script> |
| </body> |
| </html> |
| """ |
|
|
| if __name__ == "__main__": |
| app.run(host="0.0.0.0", port=7860) |