Spaces:
Running on Zero
Running on Zero
File size: 1,822 Bytes
ad371a6 f866c6b ad371a6 d2e42e4 ad371a6 f866c6b c076dd2 f866c6b ac09753 f866c6b ac09753 f866c6b 2d11c84 f866c6b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | """
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
@spaces.GPU
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)
|