Shreyas094 commited on
Commit
d4f3b18
·
verified ·
1 Parent(s): d681ee9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -493,8 +493,11 @@ def ask_question(question, temperature, top_p, repetition_penalty, web_search, c
493
 
494
  def extract_answer(full_response, instructions=None):
495
  try:
496
- # Remove the context information more specifically
497
- context_pattern = r"Context:.*?Question:.*?Entities:.*?}\s*"
 
 
 
498
  full_response = re.sub(context_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE)
499
 
500
  # List of patterns to remove
 
493
 
494
  def extract_answer(full_response, instructions=None):
495
  try:
496
+ # Remove the web search results and context information
497
+ web_results_pattern = r"Answer based on: Web Results:.*?(?=\n\n)"
498
+ context_pattern = r"Context:.*?Entities:.*?}\s*"
499
+
500
+ full_response = re.sub(web_results_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE)
501
  full_response = re.sub(context_pattern, "", full_response, flags=re.DOTALL | re.IGNORECASE)
502
 
503
  # List of patterns to remove