就是把script部分写在head,放在blocks的head参数里。html里面的script去掉还是不去掉gradio都能执行
def deal3() return "<html> xxx </html>" head = """<script type="text/javascript"> xxxx </script>""" with gr.Blocks(title='AI自动化DIFF平台',head=head) as demo: button3 = gr.Button() html = gr.HTML() button3.click(deal3, inputs=none, outputs=html)