import gradio as gr # 定义处理函数,根据用户输入生成不同的按钮 def dynamic_buttons(user_input): if user_input == "A": button_html = "" elif user_input == "B": button_html = "" else: button_html = "" return button_html # 创建 Gradio 接口,输入是文本,输出是HTML iface = gr.Interface(fn=dynamic_buttons, inputs="text", outputs="html") # 启动界面 iface.launch()