| 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() |
|
|