"""AI KING©️ look & feel: theme, CSS, starfield JS, head tags, hero/footer HTML.""" import os import gradio as gr S = "/gradio_api/file=static" # static files (gr.set_static_paths) YT = "https://www.youtube.com/@ChadSyphrett" TT = "https://www.tiktok.com/@MusicVideosTM" IG = "https://www.instagram.com/InternetThemePark" # Replace with the DistroKid HyperFollow link once it exists (Space variable MUSIC_URL). MUSIC = os.environ.get("MUSIC_URL", "https://open.spotify.com/search/Chad%20Syphrett") THEME = gr.themes.Base( primary_hue=gr.themes.colors.amber, secondary_hue=gr.themes.colors.sky, neutral_hue=gr.themes.colors.slate, radius_size=gr.themes.sizes.radius_lg, font=[gr.themes.GoogleFont("Inter"), "-apple-system", "SF Pro Text", "Segoe UI", "Roboto", "sans-serif"], font_mono=[gr.themes.GoogleFont("JetBrains Mono"), "ui-monospace", "Menlo", "monospace"], ).set( body_background_fill="#03040a", body_background_fill_dark="#03040a", body_text_color="#e8ecf6", body_text_color_dark="#e8ecf6", body_text_color_subdued="#9aa3b8", body_text_color_subdued_dark="#9aa3b8", background_fill_primary="rgba(14,16,28,0.55)", background_fill_primary_dark="rgba(14,16,28,0.55)", background_fill_secondary="rgba(255,255,255,0.03)", background_fill_secondary_dark="rgba(255,255,255,0.03)", block_background_fill="rgba(14,16,28,0.55)", block_background_fill_dark="rgba(14,16,28,0.55)", block_border_color="rgba(255,255,255,0.08)", block_border_color_dark="rgba(255,255,255,0.08)", block_label_background_fill="rgba(255,255,255,0.05)", block_label_background_fill_dark="rgba(255,255,255,0.05)", block_label_text_color="#c9d2e6", block_label_text_color_dark="#c9d2e6", block_title_text_color="#e8ecf6", block_title_text_color_dark="#e8ecf6", border_color_primary="rgba(255,255,255,0.10)", border_color_primary_dark="rgba(255,255,255,0.10)", input_background_fill="rgba(5,7,14,0.65)", input_background_fill_dark="rgba(5,7,14,0.65)", input_border_color="rgba(255,255,255,0.10)", input_border_color_dark="rgba(255,255,255,0.10)", input_border_color_focus="rgba(245,197,66,0.65)", input_border_color_focus_dark="rgba(245,197,66,0.65)", button_primary_background_fill="linear-gradient(135deg,#fff1b0 0%,#f5c542 38%,#e39b12 100%)", button_primary_background_fill_dark="linear-gradient(135deg,#fff1b0 0%,#f5c542 38%,#e39b12 100%)", button_primary_background_fill_hover="linear-gradient(135deg,#fff7d1 0%,#ffd45c 38%,#f0a81c 100%)", button_primary_background_fill_hover_dark="linear-gradient(135deg,#fff7d1 0%,#ffd45c 38%,#f0a81c 100%)", button_primary_text_color="#1a1203", button_primary_text_color_dark="#1a1203", button_primary_border_color="rgba(255,240,190,0.6)", button_primary_border_color_dark="rgba(255,240,190,0.6)", button_secondary_background_fill="rgba(255,255,255,0.06)", button_secondary_background_fill_dark="rgba(255,255,255,0.06)", button_secondary_background_fill_hover="rgba(255,255,255,0.12)", button_secondary_background_fill_hover_dark="rgba(255,255,255,0.12)", button_secondary_text_color="#e8ecf6", button_secondary_text_color_dark="#e8ecf6", button_secondary_border_color="rgba(255,255,255,0.12)", button_secondary_border_color_dark="rgba(255,255,255,0.12)", slider_color="#f5c542", slider_color_dark="#f5c542", checkbox_background_color_selected="#f5c542", checkbox_background_color_selected_dark="#f5c542", checkbox_label_background_fill="rgba(255,255,255,0.04)", checkbox_label_background_fill_dark="rgba(255,255,255,0.04)", checkbox_label_background_fill_selected="rgba(245,197,66,0.16)", checkbox_label_background_fill_selected_dark="rgba(245,197,66,0.16)", checkbox_label_border_color_selected="rgba(245,197,66,0.7)", checkbox_label_border_color_selected_dark="rgba(245,197,66,0.7)", color_accent_soft="rgba(245,197,66,0.14)", color_accent_soft_dark="rgba(245,197,66,0.14)", shadow_drop="0 10px 40px rgba(0,0,0,.45)", shadow_drop_lg="0 18px 60px rgba(0,0,0,.55)", block_shadow="0 10px 40px rgba(0,0,0,.35)", block_shadow_dark="0 10px 40px rgba(0,0,0,.35)", layout_gap="14px", ) HEAD = f""" """ JS = r""" () => { document.documentElement.classList.add('dark'); document.body.classList.add('dark'); if (!document.getElementById('aik-stars')) { const c = document.createElement('canvas'); c.id = 'aik-stars'; document.body.prepend(c); const neb = document.createElement('div'); neb.id = 'aik-nebula'; document.body.prepend(neb); const x = c.getContext('2d'); let W, H, stars = [], comets = [], dpr = Math.min(window.devicePixelRatio || 1, 2); const reduce = window.matchMedia('(prefers-reduced-motion: reduce)').matches; function size() { W = c.width = innerWidth * dpr; H = c.height = innerHeight * dpr; c.style.width = innerWidth + 'px'; c.style.height = innerHeight + 'px'; const n = Math.min(260, Math.floor(innerWidth * innerHeight / 5200)); stars = Array.from({length: n}, () => ({x: Math.random()*W, y: Math.random()*H, z: Math.random()*0.8+0.2, r: (Math.random()*1.3+0.25)*dpr, t: Math.random()*6.28, hue: Math.random() < .12 ? 45 : (Math.random() < .5 ? 210 : 265)})); } size(); addEventListener('resize', size); function frame(ts) { x.clearRect(0, 0, W, H); for (const s of stars) { s.t += 0.015 * s.z; s.y += 0.06 * s.z * dpr; if (s.y > H) { s.y = 0; s.x = Math.random()*W; } const a = 0.35 + 0.65 * Math.abs(Math.sin(s.t)); x.beginPath(); x.arc(s.x, s.y, s.r, 0, 6.283); x.fillStyle = `hsla(${s.hue}, 90%, ${s.hue===45?70:88}%, ${a*s.z})`; x.fill(); } if (Math.random() < 0.006 && comets.length < 2) comets.push({x: Math.random()*W*0.7, y: Math.random()*H*0.35, vx: (4+Math.random()*4)*dpr, vy: (1.6+Math.random()*1.6)*dpr, life: 1}); comets = comets.filter(m => m.life > 0); for (const m of comets) { const g = x.createLinearGradient(m.x, m.y, m.x - m.vx*22, m.y - m.vy*22); g.addColorStop(0, `rgba(255,255,255,${m.life})`); g.addColorStop(0.3, `rgba(159,216,255,${m.life*0.5})`); g.addColorStop(1, 'rgba(180,140,255,0)'); x.strokeStyle = g; x.lineWidth = 2*dpr; x.beginPath(); x.moveTo(m.x, m.y); x.lineTo(m.x - m.vx*22, m.y - m.vy*22); x.stroke(); m.x += m.vx; m.y += m.vy; m.life -= 0.012; } if (!reduce) requestAnimationFrame(frame); } requestAnimationFrame(frame); } // quick-launch cards switch tabs window.aikGo = (label) => { const want = (label || '').toLowerCase(); const btns = [...document.querySelectorAll('.tabs button')].filter(b => b.getAttribute('tabindex') !== '-1' && b.textContent.trim().toLowerCase().includes(want)); const vis = btns.find(b => b.getAttribute('role') === 'tab' && b.offsetParent !== null); const over = btns.find(b => !b.getAttribute('role')); const t = vis || over || btns[0]; if (t) { t.click(); setTimeout(() => { const w = document.querySelector('.tabs'); w && w.scrollIntoView({behavior: 'smooth', block: 'start'}); }, 80); } }; // inside the AI KING iOS app (Capacitor): route downloads to the native share sheet const cap = window.Capacitor; if (cap && cap.isNativePlatform && cap.isNativePlatform()) { document.body.classList.add('aik-native'); document.addEventListener('click', (e) => { const a = e.target.closest && e.target.closest('a[download]'); const share = cap.Plugins && cap.Plugins.Share; if (a && share) { e.preventDefault(); share.share({title: 'Made with AI KING', url: new URL(a.href, location.href).href}).catch(() => {}); } }, true); } if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw.js').catch(() => {}); } } """ CSS = r""" @property --aik-angle { syntax: ''; initial-value: 0deg; inherits: false; } html, body, gradio-app { background: #03040a !important; } #aik-stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; } #aik-nebula { position: fixed; inset: -20%; z-index: 0; pointer-events: none; background: radial-gradient(40% 35% at 18% 12%, rgba(124, 58, 237, .22), transparent 70%), radial-gradient(35% 30% at 85% 8%, rgba(14, 165, 233, .16), transparent 70%), radial-gradient(45% 40% at 70% 92%, rgba(245, 197, 66, .10), transparent 70%), radial-gradient(30% 30% at 8% 85%, rgba(236, 72, 153, .10), transparent 70%); filter: blur(10px); animation: aikDrift 38s ease-in-out infinite alternate; } @keyframes aikDrift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(2%, -2%, 0) scale(1.06); } } .gradio-container { position: relative; z-index: 1; max-width: min(1240px, 100vw) !important; min-width: 0 !important; margin: 0 auto !important; padding: max(10px, env(safe-area-inset-top)) clamp(10px, 2.4vw, 28px) 40px !important; background: transparent !important; font-feature-settings: "ss01", "cv11"; -webkit-font-smoothing: antialiased; } footer { display: none !important; } /* ---------- glass panels with intergalactic edge glow ---------- */ .block, .form { backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); } .block { border-radius: 20px !important; } .aik-card { position: relative; border-radius: 26px !important; padding: 16px !important; background: linear-gradient(180deg, rgba(22,24,40,.72), rgba(10,12,22,.62)) !important; border: 1px solid rgba(255,255,255,.07) !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 24px 70px rgba(0,0,0,.5) !important; isolation: isolate; } .aik-card::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1.2px; z-index: -1; background: conic-gradient(from var(--aik-angle), rgba(245,197,66,.0) 0deg, rgba(245,197,66,.75) 40deg, rgba(159,216,255,.65) 110deg, rgba(180,140,255,.55) 170deg, rgba(245,197,66,0) 230deg, rgba(236,72,153,.35) 300deg, rgba(245,197,66,0) 360deg); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; animation: aikSpin 9s linear infinite; opacity: .85; } .aik-card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; background: radial-gradient(120% 60% at 50% -10%, rgba(255,255,255,.07), transparent 60%); } @keyframes aikSpin { to { --aik-angle: 360deg; } } /* ---------- hero ---------- */ #aik-hero { text-align: center; padding: 18px 8px 6px; max-width: 100%; min-width: 0; overflow: hidden; } .html-container, .html-container > .prose, .block:has(#aik-hero), .block:has(#aik-foot) { min-width: 0 !important; max-width: 100% !important; } html, body { overflow-x: hidden; } .aik-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; } .aik-brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; } .aik-brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: 0 0 22px rgba(245,197,66,.35); } .aik-brand b { font-family: Michroma, Inter, sans-serif; letter-spacing: .14em; font-size: .82rem; color: #f3f5fb; } .aik-pill-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; } .aik-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #e8ecf6 !important; text-decoration: none !important; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10); transition: transform .2s, background .2s, box-shadow .2s; } .aik-pill:hover { transform: translateY(-1px); background: rgba(255,255,255,.12); box-shadow: 0 0 22px rgba(159,216,255,.18); } .aik-pill.gold { background: linear-gradient(135deg, rgba(255,241,176,.22), rgba(227,155,18,.18)); border-color: rgba(245,197,66,.45); } .aik-word { font-family: Michroma, Inter, sans-serif; font-weight: 400; font-size: clamp(2.3rem, 8.5vw, 5.4rem); line-height: 1.02; letter-spacing: .06em; margin: 18px 0 4px; background: linear-gradient(100deg, #8a5a06 0%, #f5c542 18%, #fff6cf 30%, #f5c542 42%, #d09a1c 60%, #fff2b8 75%, #f5c542 90%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: aikShine 7s linear infinite; filter: drop-shadow(0 0 26px rgba(245,197,66,.28)); } .aik-word sup { font-size: .32em; vertical-align: super; letter-spacing: 0; } @keyframes aikShine { to { background-position: -220% 0; } } .aik-sub { font-family: Michroma, Inter, sans-serif; letter-spacing: .42em; font-size: clamp(.62rem, 1.9vw, .82rem); color: #9fd8ff; opacity: .9; } .aik-tag { margin: 14px auto 0; max-width: 680px; color: #b7c0d6; font-size: clamp(.92rem, 2.6vw, 1.06rem); line-height: 1.55; } .aik-stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 6px; } .aik-stat { min-width: 108px; padding: 10px 14px; border-radius: 18px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); } .aik-stat b { display: block; font-size: 1.32rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; } .aik-stat span { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #8f9ab3; } .aik-stat.live b { background: linear-gradient(90deg,#fff6cf,#f5c542); -webkit-background-clip: text; background-clip: text; color: transparent; } .aik-store { font-size: .66rem; color: #6f7a93; margin-top: 4px; } /* stories row (Instagram-style) */ .aik-stories { width: 100%; max-width: 100%; min-width: 0; display: flex; gap: 14px; overflow-x: auto; padding: 14px 4px 6px; scrollbar-width: none; justify-content: flex-start; } .aik-stories::-webkit-scrollbar { display: none; } .aik-story { flex: 0 0 auto; text-align: center; width: 78px; } .aik-story i { display: block; width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 50%; padding: 3px; background: conic-gradient(from 210deg, #f5c542, #ec4899, #8b5cf6, #38bdf8, #f5c542); animation: aikPulse 4s ease-in-out infinite; } .aik-story img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #03040a; display: block; } .aik-story span { font-size: .66rem; color: #aab3c8; white-space: nowrap; } @keyframes aikPulse { 50% { filter: brightness(1.25) saturate(1.2); } } /* quick-launch grid (Gemini-style cards) */ .aik-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0 4px; } .aik-tile { cursor: pointer; text-align: left; padding: 16px; border-radius: 22px; background: linear-gradient(160deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border: 1px solid rgba(255,255,255,.08); transition: transform .25s, box-shadow .25s, border-color .25s; position: relative; overflow: hidden; } .aik-tile:hover { transform: translateY(-3px); border-color: rgba(245,197,66,.45); box-shadow: 0 14px 40px rgba(0,0,0,.45), 0 0 30px rgba(245,197,66,.14); } .aik-tile::after { content: ""; position: absolute; top: -60%; left: -30%; width: 40%; height: 220%; transform: rotate(25deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.10), transparent); transition: left .6s; } .aik-tile:hover::after { left: 120%; } .aik-tile em { font-style: normal; font-size: 1.5rem; } .aik-tile b { display: block; margin-top: 8px; color: #fff; font-size: .95rem; } .aik-tile span { display: block; margin-top: 3px; font-size: .76rem; color: #8f9ab3; line-height: 1.35; } @media (max-width: 860px) { .aik-grid { grid-template-columns: repeat(2, 1fr); } } /* ---------- tabs as a glossy pill nav ---------- */ .tabs > .tab-wrapper, div[role="tablist"] { position: sticky; top: 0; z-index: 20; } .tab-wrapper { background: rgba(6,8,16,.72) !important; backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); border: 1px solid rgba(255,255,255,.08) !important; border-radius: 999px !important; padding: 5px !important; margin: 8px 0 14px !important; box-shadow: 0 10px 40px rgba(0,0,0,.45); } .tabs, .tab-wrapper { min-width: 0 !important; max-width: 100% !important; } .tab-container, div[role="tablist"] { gap: 4px !important; border: none !important; min-width: 0 !important; max-width: 100% !important; overflow: hidden; } .tab-container::-webkit-scrollbar { display: none; } button[role="tab"] { border-radius: 999px !important; padding: 9px 15px !important; font-weight: 600 !important; font-size: .86rem !important; color: #aab3c8 !important; border: 1px solid transparent !important; background: transparent !important; white-space: nowrap; transition: all .2s; } button[role="tab"]:hover { color: #fff !important; background: rgba(255,255,255,.06) !important; } button[role="tab"][aria-selected="true"], button[role="tab"].selected { color: #1a1203 !important; background: linear-gradient(135deg, #fff1b0, #f5c542 45%, #e39b12) !important; box-shadow: 0 0 22px rgba(245,197,66,.35); } button[role="tab"][aria-selected="true"]::after, button[role="tab"].selected::after { display: none !important; } .tabitem { border: none !important; background: transparent !important; padding: 0 !important; } /* ---------- buttons ---------- */ button.primary, .primary { position: relative; overflow: hidden; border-radius: 999px !important; font-weight: 800 !important; letter-spacing: .02em; box-shadow: 0 8px 30px rgba(245,197,66,.28), inset 0 1px 0 rgba(255,255,255,.65) !important; } button.primary::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; transform: skewX(-20deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: aikSweep 3.8s ease-in-out infinite; } @keyframes aikSweep { 0%, 60% { left: -60%; } 100% { left: 140%; } } button.secondary { border-radius: 999px !important; } button.lg { min-height: 50px; font-size: 1rem !important; } /* ---------- inputs ---------- */ textarea, input[type="text"], input[type="number"] { border-radius: 16px !important; } textarea:focus, input:focus { box-shadow: 0 0 0 3px rgba(245,197,66,.18), 0 0 24px rgba(159,216,255,.12) !important; } #aik-prompt textarea { font-size: 1.05rem !important; line-height: 1.5; min-height: 96px; } label > span, .block-title, [data-testid="block-label"] { letter-spacing: .02em; } .aik-chips .wrap { gap: 8px !important; } .aik-chips label { border-radius: 999px !important; padding: 7px 13px !important; font-size: .84rem !important; } .aik-chips label input { display: none; } /* gallery / media */ .grid-wrap, .gallery { border-radius: 18px; } .thumbnail-item { border-radius: 14px !important; overflow: hidden; } video, .image-frame img { border-radius: 16px; } /* section headers */ .aik-h { display: flex; align-items: baseline; gap: 10px; margin: 2px 2px 10px; } .aik-h h2 { margin: 0; font-size: 1.28rem; font-weight: 800; color: #fff; letter-spacing: -.01em; } .aik-h span { color: #8f9ab3; font-size: .85rem; } .aik-note { font-size: .8rem; color: #8f9ab3; } .aik-soon { padding: 22px; border-radius: 22px; border: 1px dashed rgba(245,197,66,.35); background: rgba(245,197,66,.05); } .aik-soon h3 { margin: 0 0 6px; color: #fff; } .prose, .md { color: #c9d2e6; } .prose a, .md a { color: #9fd8ff; } /* footer */ #aik-foot { text-align: center; padding: 26px 8px 10px; color: #8f9ab3; font-size: .8rem; } #aik-foot .aik-pill-row { margin-bottom: 12px; } #aik-foot a.l { color: #9fd8ff; } /* ---------- mobile (iPhone Safari etc.) ---------- */ @media (max-width: 640px) { .gradio-container { padding-left: 8px !important; padding-right: 8px !important; } .gradio-container > .main, .gradio-container div.main.fillable, .gradio-container div.main, .gradio-container .main > .wrap, main.contain { padding-left: 0 !important; padding-right: 0 !important; } .html-container { padding-left: 0 !important; padding-right: 0 !important; } #aik-hero { padding-left: 2px; padding-right: 2px; } .aik-sub { letter-spacing: .22em; } .aik-stats { gap: 6px; } .aik-stat { flex: 1 1 28%; min-width: 0; } .aik-stat span { letter-spacing: .06em; font-size: .6rem; } .aik-card { padding: 10px !important; border-radius: 22px !important; } .aik-stat { min-width: 84px; padding: 8px 10px; } .aik-stat b { font-size: 1.05rem; } .aik-top .aik-pill-row { display: none; } button[role="tab"] { padding: 8px 12px !important; font-size: .8rem !important; } .aik-grid { gap: 8px; } .aik-tile { padding: 12px; border-radius: 18px; } .aik-tile span { display: none; } } @media (prefers-reduced-motion: reduce) { .aik-card::before, .aik-word, #aik-nebula, button.primary::after, .aik-story i { animation: none !important; } } """ def hero_html(stats: dict, store: str) -> str: def f(n): return f"{n:,}" stories = "".join( f'
{t}
' for i, t in enumerate(["Throne", "Monarchs", "Holo Kicks", "Fedora", "World Peace", "Portrait", "CAR MAN", "Navy Suit"], 1)) return f"""
AI KING©️
STUDIO · BY KING OF MUSIC©️

Images, edits, videos, loops, remixes & music videos. One glossy studio, free, right in your browser. Add it to your iPhone home screen and create anywhere.

{f(stats.get('visits', 0))}Visits
{f(stats.get('creations', 0))}Creations
{f(stats.get('images', 0) + stats.get('edits', 0))}Images
{f(stats.get('videos', 0))}Videos
{f(stats.get('audio', 0) + stats.get('loops', 0))}Audio · Loops
Live counter · stored in {store}
{stories}
✨CreateText → image in seconds (FLUX)
🎨EditRestyle any photo: image → image
🎬VideoText/image → video & seamless loops (LTX)
🎧Audio LabRemix, slow, speed up, loop, music videos
""" FOOTER = f"""
AI KING©️ · KING OF MUSIC©️ · Chad Syphrett · Non-explicit creative use only · Privacy · Terms
📲 iPhone: Share → Add to Home Screen · Android: ⋮ → Install app
Everyday Is A Lesson. Be Thankful To YHWH! 👑
"""