Shreyas094 commited on
Commit
ff847c0
·
verified ·
1 Parent(s): 8ed18da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -517,8 +517,9 @@ def extract_answer(full_response, instructions=None):
517
  full_response = re.sub(instruction_pattern, "", full_response, flags=re.IGNORECASE | re.DOTALL)
518
 
519
  # Remove any remaining instruction-like phrases at the beginning of the response
520
- lines = full_response.split('\n')
521
- while lines and any(line.strip().lower().startswith(starter) for starter in ["answer:", "response:", "here's", "here is"]):
 
522
  lines.pop(0)
523
  full_response = '\n'.join(lines)
524
 
 
517
  full_response = re.sub(instruction_pattern, "", full_response, flags=re.IGNORECASE | re.DOTALL)
518
 
519
  # Remove any remaining instruction-like phrases at the beginning of the response
520
+ lines = full_response.split('\n')
521
+ starters = ["answer:", "response:", "here's", "here is"]
522
+ while lines and any(lines[0].strip().lower().startswith(starter) for starter in starters):
523
  lines.pop(0)
524
  full_response = '\n'.join(lines)
525