Spaces:
Running on Zero
Running on Zero
| """ | |
| Hugging Face Spaces - Full Cyberpunk UI for malloc() | |
| """ | |
| import os | |
| import spaces | |
| import gradio as gr | |
| from pathlib import Path | |
| from app.main import app as fastapi_app | |
| # ZeroGPU decorator | |
| def predict_gpu(prompt: str = ""): | |
| return "malloc() ZeroGPU engine active" | |
| # Read your exact HTML, CSS, and JS | |
| static_dir = Path("app/static") | |
| html_file = static_dir / "index.html" | |
| css_file = static_dir / "style.css" | |
| js_file = static_dir / "app.js" | |
| html_code = html_file.read_text(encoding="utf-8") if html_file.exists() else "<h1>Loading malloc()...</h1>" | |
| css_code = css_file.read_text(encoding="utf-8") if css_file.exists() else "" | |
| js_code = js_file.read_text(encoding="utf-8") if js_file.exists() else "" | |
| # Extract inner body content | |
| if "<body" in html_code: | |
| body_part = html_code.split(">", 1)[1] if "<body" in html_code else html_code | |
| body_content = html_code[html_code.find(">", html_code.find("<body")) + 1 : html_code.rfind("</body>")] | |
| else: | |
| body_content = html_code | |
| # Inject full cyberpunk styles and behavior | |
| custom_head = f""" | |
| <link rel="preconnect" href="https://fonts.googleapis.com"> | |
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
| <link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet"> | |
| <style> | |
| {css_code} | |
| .gradio-container {{ max-width: 100% !important; padding: 0 !important; margin: 0 !important; background: var(--bg-deep, #0e0e11) !important; }} | |
| footer, .svelte-1v4bhr5 {{ display: none !important; }} | |
| </style> | |
| <script> | |
| window.addEventListener("DOMContentLoaded", () => {{ | |
| {js_code} | |
| }}); | |
| </script> | |
| """ | |
| with gr.Blocks(title="malloc() — AI Career OS", head=custom_head) as demo: | |
| gr.HTML(body_content) | |
| demo.launch(server_name="0.0.0.0", server_port=7860) | |