parry / app_blocks.py
Jainamshahhh's picture
deploy parry
5fc018c verified
Raw
History Blame Contribute Delete
919 Bytes
"""
HEDGE 2 (rules-level): plain `gr.Blocks` + full-bleed `gr.HTML` wrapping the
IDENTICAL built bundle in a same-origin iframe served via the file route.
Activate by setting `app_file: app_blocks.py` in README.md — zero bundle changes.
Spike checks (§9.0 path C): WebGPU + module Worker + IndexedDB inside the
nested iframe; sizing; pointer/keyboard not captured by Gradio.
"""
from __future__ import annotations
import gradio as gr
CSS = """
footer {display: none !important;}
.gradio-container {padding: 0 !important; max-width: 100% !important;}
#game-frame iframe {width: 100vw; height: 100dvh; border: 0; display: block;}
"""
IFRAME = '<iframe src="/gradio_api/file=static/index.html" allow="autoplay" title="Parry"></iframe>'
with gr.Blocks(css=CSS, title="Parry") as demo:
gr.HTML(IFRAME, elem_id="game-frame")
if __name__ == "__main__":
demo.launch(allowed_paths=["static"], show_error=True)