Spaces:
Running
Running
| from html import escape | |
| from pathlib import Path | |
| import gradio as gr | |
| ROOT = Path(__file__).resolve().parent | |
| APP_HTML = (ROOT / "index.html").read_text(encoding="utf-8") | |
| def render_app() -> str: | |
| srcdoc = escape(APP_HTML, quote=True) | |
| return ( | |
| '<iframe id="bbox-app-frame" ' | |
| f'srcdoc="{srcdoc}" ' | |
| 'sandbox="allow-scripts allow-same-origin allow-downloads" ' | |
| 'allow="clipboard-read; clipboard-write"></iframe>' | |
| ) | |
| with gr.Blocks( | |
| title="Bounding Box Demo", | |
| css=""" | |
| .gradio-container { | |
| max-width: none !important; | |
| padding: 0 !important; | |
| background: #f3f6fb !important; | |
| } | |
| #bbox-app-frame { | |
| display: block; | |
| width: 100%; | |
| min-height: 900px; | |
| height: calc(100vh - 18px); | |
| border: 0; | |
| background: #f3f6fb; | |
| } | |
| footer { | |
| display: none !important; | |
| } | |
| """, | |
| ) as demo: | |
| gr.HTML(render_app()) | |
| if __name__ == "__main__": | |
| demo.launch() | |