Spaces:
Sleeping
Sleeping
File size: 1,650 Bytes
638aac9 134ab9f 638aac9 134ab9f 638aac9 898587a 638aac9 134ab9f 898587a | 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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | from pathlib import Path
import html
import gradio as gr
ROOT = Path(__file__).parent.resolve()
def build_iframe() -> str:
document = (ROOT / "index.html").read_text(encoding="utf-8")
document = document.replace('href="/src/styles.css"', 'href="/gradio_api/file=src/styles.css"')
document = document.replace('src="/src/main.js"', 'src="/gradio_api/file=src/main.js"')
srcdoc = html.escape(document, quote=True)
return f"""
<iframe
title="Gaussian Splat Walkthrough"
srcdoc="{srcdoc}"
allow="fullscreen; xr-spatial-tracking"
sandbox="allow-scripts allow-same-origin allow-pointer-lock allow-forms allow-popups"
style="position:fixed; inset:0; width:100vw; height:100vh; border:0; background:#030607;"
></iframe>
"""
css = """
html, body, gradio-app, .gradio-container {
margin: 0 !important;
width: 100% !important;
min-width: 100% !important;
height: 100% !important;
min-height: 100vh !important;
overflow: hidden !important;
background: #030607 !important;
}
.gradio-container {
max-width: none !important;
padding: 0 !important;
}
footer,
.footer {
display: none !important;
}
#splat-frame {
position: fixed !important;
inset: 0 !important;
width: 100vw !important;
height: 100vh !important;
padding: 0 !important;
margin: 0 !important;
}
#splat-frame > div {
padding: 0 !important;
margin: 0 !important;
}
"""
with gr.Blocks(title="Gaussian Splat Walkthrough", fill_height=True, fill_width=True) as demo:
gr.HTML(build_iframe(), elem_id="splat-frame")
if __name__ == "__main__":
demo.launch(allowed_paths=[str(ROOT)], css=css)
|