iAIChat commited on
Commit
463f80e
·
1 Parent(s): a7e8209

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -153,6 +153,11 @@ def run_chain(user_query):
153
  else:
154
  print("Invalid inputs.")
155
 
 
 
 
 
 
156
  iface = gr.Interface(fn=run_chain, inputs="text", outputs="text", title="AI Response")
157
- iface.launch()
158
- atexit.register(exit_handler)
 
153
  else:
154
  print("Invalid inputs.")
155
 
156
+ def button_callback():
157
+ atexit.register(exit_handler)
158
+
159
+ button = gr.inputs.Button(label="Clear Data", callback=button_callback, help="Click me to clear data before exiting this program.")
160
+
161
  iface = gr.Interface(fn=run_chain, inputs="text", outputs="text", title="AI Response")
162
+ iface.inputs = [button] # 将按钮添加到输入组件列表中
163
+ iface.launch()