petrified commited on
Commit
070589c
·
verified ·
1 Parent(s): 76e6bd8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -191,12 +191,17 @@ with gr.Blocks() as demo:
191
  height=500
192
  )
193
  with gr.Column():
194
- gr.ChatInterface(
195
- random_response,
196
- examples=['Top 10 prod_cate sales','Top product in category Seafood'],
197
- type="messages",
198
- autofocus=False,
199
- additional_outputs=[temp_img]
 
 
200
  )
 
 
 
201
 
202
  demo.launch()
 
191
  height=500
192
  )
193
  with gr.Column():
194
+ # 创建一个文本输入框用于聊天
195
+ chat_input = gr.Textbox(placeholder="Type your message here...", label="Chat")
196
+ chat_output = gr.Textbox(label="Response", interactive=False)
197
+
198
+ # 示例组件,始终可见
199
+ examples = gr.Examples(
200
+ examples=['Top 10 prod_cate sales', 'Top product in category Seafood','sales trend of product name called lobster by time per day'],
201
+ inputs=chat_input
202
  )
203
+
204
+ # 绑定 chat_input 的变化到 random_response 函数
205
+ chat_input.change(fn=random_response, inputs=chat_input, outputs=[chat_output, temp_img])
206
 
207
  demo.launch()