Add data-iframe-height sentinel for HF Spaces iframe-resizer auto-sizing
Browse files- demo/app.py +8 -0
demo/app.py
CHANGED
|
@@ -3014,6 +3014,14 @@ with gr.Blocks(theme=theme, title="EmpathRAG Studio", css=APP_CSS, js=_CHATBOT_A
|
|
| 3014 |
):
|
| 3015 |
diag_block = gr.HTML(value=format_studio_diagnostics(None))
|
| 3016 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3017 |
# Hidden state surfaces (kept to preserve respond() output contract)
|
| 3018 |
session_id_box = gr.Textbox(value=initial_state["session_id"], visible=False)
|
| 3019 |
|
|
|
|
| 3014 |
):
|
| 3015 |
diag_block = gr.HTML(value=format_studio_diagnostics(None))
|
| 3016 |
|
| 3017 |
+
# iframe-resizer height anchor for HF Spaces deployment.
|
| 3018 |
+
# HF Spaces uses iframe-resizer in `taggedElement` mode to auto-size the
|
| 3019 |
+
# iframe to the Gradio app's content height. Without an element marked with
|
| 3020 |
+
# `data-iframe-height`, the iframe falls back to a default short height
|
| 3021 |
+
# and clips the top of the page (topbar, hero, etc.). This sentinel div
|
| 3022 |
+
# at the very end of the layout tells iframe-resizer how tall to grow.
|
| 3023 |
+
gr.HTML('<div data-iframe-height style="height:1px;width:1px;"></div>')
|
| 3024 |
+
|
| 3025 |
# Hidden state surfaces (kept to preserve respond() output contract)
|
| 3026 |
session_id_box = gr.Textbox(value=initial_state["session_id"], visible=False)
|
| 3027 |
|