import gradio as gr html = ''' ''' script = ''' function test(){ let script = document.createElement('script'); script.innerHTML = "function click_text(){alert('click')}"; document.head.appendChild(script); } ''' with gr.Blocks() as block: gr.HTML(html) block.load(js = script) block.launch(debug=True, share=False) block.close()