Shreyas094 commited on
Commit
7f4043c
1 Parent(s): 50473dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -180,7 +180,7 @@ def respond(
180
  if search_engine == "Google":
181
  search_results = google_search(message)
182
  else:
183
- search_results = duckduckgo_search(message)
184
 
185
  # Check if we have a FAISS database
186
  if os.path.exists("faiss_database"):
@@ -231,7 +231,9 @@ def respond(
231
  sources_section = "\n\nSources:\n" + "\n".join(f"- {source}" for source in sources)
232
  response += sources_section
233
 
234
- return response
 
 
235
 
236
  # Gradio interface
237
  demo = gr.Blocks()
@@ -262,14 +264,14 @@ with demo:
262
  respond,
263
  inputs=[
264
  message_input,
265
- chatbot,
266
  temperature,
267
  top_p,
268
  repetition_penalty,
269
  max_tokens,
270
  search_engine
271
  ],
272
- outputs=chatbot
273
  )
274
 
275
  clear_button = gr.Button("Clear Cache")
 
180
  if search_engine == "Google":
181
  search_results = google_search(message)
182
  else:
183
+ search_results = duckduckgo_search(message, max_results=5)
184
 
185
  # Check if we have a FAISS database
186
  if os.path.exists("faiss_database"):
 
231
  sources_section = "\n\nSources:\n" + "\n".join(f"- {source}" for source in sources)
232
  response += sources_section
233
 
234
+ # Update history and return
235
+ history.append((message, response))
236
+ return history
237
 
238
  # Gradio interface
239
  demo = gr.Blocks()
 
264
  respond,
265
  inputs=[
266
  message_input,
267
+ gr.State([]), # Initialize empty history
268
  temperature,
269
  top_p,
270
  repetition_penalty,
271
  max_tokens,
272
  search_engine
273
  ],
274
+ outputs=[chatbot]
275
  )
276
 
277
  clear_button = gr.Button("Clear Cache")