import html
import json
from pathlib import Path
import gradio as gr
import spaces
# Satisfy ZeroGPU startup check
@spaces.GPU
def _init_zero_gpu():
return True
_init_zero_gpu()
BASE = Path(__file__).parent
SCHEMES = json.loads((BASE / "scheme_data.json").read_text(encoding="utf-8"))
QUESTIONS = json.loads((BASE / "questions.json").read_text(encoding="utf-8"))
AVATARS = json.loads((BASE / "avatars.json").read_text(encoding="utf-8"))
def build_page() -> str:
"""Return the full, self-contained HTML page with the JSON data embedded."""
raw_html = (BASE / "app.html").read_text(encoding="utf-8")
payload = {"schemes": SCHEMES, "questions": QUESTIONS, "avatars": AVATARS}
# "" is escaped so the JSON can never close the ',
)
def load_interface() -> str:
# gr.HTML does NOT execute