GitHub Actions commited on
Commit ·
a8b67a8
1
Parent(s): f6ead22
fix: easter-egg script now properly injected via Gradio head parameter
Browse filesGradio doesn't execute scripts in innerHTML. The warning was correct.
Moved the script from gr.HTML() component to the head parameter of
gr.Blocks(), where it executes properly on page load.
The HTML component now only contains CSS and the ticker element.
The script is injected into document head by Gradio and runs correctly.
Press 'e' in any tab to toggle the ⚡ LIVE ticker.
148 unmodified lines149150151152153154155156148 unmodified linesnode_id_display = self._meta.get("node_id", "unknown")display_name = self._meta.get("display_name", node_id_display[:20])with gr.Blocks(title=f"HearthNet — {display_name}") as demo:# Inject easter egg tickergr.HTML(value=_EASTER_EGG_CSS)gr.Markdown(f"# 🔥 HearthNet — {display_name}")148 unmodified lines149150151152153154155156148 unmodified linesnode_id_display = self._meta.get("node_id", "unknown")display_name = self._meta.get("display_name", node_id_display[:20])with gr.Blocks(title=f"HearthNet — {display_name}", head=_EASTER_EGG_SCRIPT) as demo:# Inject easter egg ticker CSS & HTMLgr.HTML(value=_EASTER_EGG_CSS)gr.Markdown(f"# 🔥 HearthNet — {display_name}")
hearthnet/ui/app.py+2-2