import gradio as gr
def welcome(name,btn):
# 在回复消息中嵌入 JavaScript 代码
js_code = ""
response = f"Hello! Click the button below:
"
return "response"
with gr.Blocks() as demo:
gr.Markdown(
"""
# Hello World!
Start typing below to see the output.
""")
inp = gr.Textbox(placeholder="What is your name?")
out = gr.Textbox()
btn = gr.Button("1")
def changeIcon(btnw):
# btnw.icon = "didi.jpeg"
return "tt",gr.update(value="", interactive=True)
inp.change(welcome, [inp,btn], btn).then(changeIcon,btn,btn)
if __name__ == "__main__":
demo.launch()