File size: 1,036 Bytes
3a48d67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pathlib import Path
import html as html_escape

import gradio as gr


APP_HTML_PATH = Path(__file__).with_name("index.html")
APP_HTML = APP_HTML_PATH.read_text(encoding="utf-8")
IFRAME_DOC = html_escape.escape(APP_HTML, quote=True)

CUSTOM_CSS = """
html, body, .gradio-container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    min-height: 100vh !important;
    background: #0b0d10 !important;
}
footer {display: none !important;}
#component-0 {padding: 0 !important; margin: 0 !important;}
"""

IFRAME = f"""
<iframe
    title="Open-Loop Society Simulator v0.1.1"
    srcdoc="{IFRAME_DOC}"
    style="width:100%; height:100vh; min-height:900px; border:0; display:block; background:#0b0d10;"
    sandbox="allow-scripts allow-downloads allow-forms allow-same-origin"
></iframe>
"""

with gr.Blocks(css=CUSTOM_CSS, fill_width=True, fill_height=True, title="Open Loop Society Simulator") as demo:
    gr.HTML(IFRAME)

if __name__ == "__main__":
    demo.launch()