nadaaaita commited on
Commit
bc652b7
1 Parent(s): c6e47c7

text box will clear after search in third tab

Browse files
Files changed (1) hide show
  1. app.py +12 -26
app.py CHANGED
@@ -230,32 +230,18 @@ with gr.Blocks(css=css) as demo:
230
  generic_chatbot_output = gr.Chatbot(height=600)
231
  user_input_gc = gr.Textbox(placeholder="Type your question here...", label="Your Question", value="Loaves and fishes")
232
  submit_button_gc = gr.Button("Submit")
233
-
234
- with gr.Column(scale=1):
235
- gr.Markdown("""
236
- <div class="source-box">
237
- <strong>About this chatbot:</strong>
238
- <p>This chatbot has access to a vector database of some SRF publications that it can use if necessary, but it receives no other specific instructions. You can ask it anything. If you want quotes and references, you need to explicitly request them in your query.</p>
239
- </div>
240
- """)
241
-
242
- with gr.Column(scale=1):
243
- gr.Markdown("""
244
- <div class="source-box">
245
- <strong>Available sources:</strong>
246
- <ul>
247
- <li>Journey to Self-Realization</li>
248
- <li>The Second Coming of Christ</li>
249
- <li>Autobiography of a Yogi</li>
250
- </ul>
251
- </div>
252
- """)
253
-
254
- submit_button_gc.click(
255
- fn=respond_genericchatbot,
256
- inputs=[user_input_gc, generic_chatbot_output],
257
- outputs=[generic_chatbot_output]
258
- )
259
 
260
  gr.Examples(
261
  examples=[
 
230
  generic_chatbot_output = gr.Chatbot(height=600)
231
  user_input_gc = gr.Textbox(placeholder="Type your question here...", label="Your Question", value="Loaves and fishes")
232
  submit_button_gc = gr.Button("Submit")
233
+
234
+ # ... (existing code for the column with markdown)
235
+
236
+ def respond_and_clear(query, history):
237
+ updated_history = respond_genericchatbot(query, history)
238
+ return updated_history, "" # Return updated history and empty string for input
239
+
240
+ submit_button_gc.click(
241
+ fn=respond_and_clear,
242
+ inputs=[user_input_gc, generic_chatbot_output],
243
+ outputs=[generic_chatbot_output, user_input_gc]
244
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
 
246
  gr.Examples(
247
  examples=[