Pijush2023 commited on
Commit
abe45f3
·
verified ·
1 Parent(s): 8a50b3a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -468,7 +468,12 @@ def clean_response(response_text):
468
  response_text = re.sub(r'<\|system\|>.*?<\|end\|>', '', response_text, flags=re.DOTALL)
469
  response_text = re.sub(r'<\|user\|>.*?<\|end\|>', '', response_text, flags=re.DOTALL)
470
  response_text = re.sub(r'<\|assistant\|>', '', response_text, flags=re.DOTALL)
471
-
 
 
 
 
 
472
  # Clean up the text by removing extra whitespace
473
  cleaned_response = response_text.strip()
474
  cleaned_response = re.sub(r'\s+', ' ', cleaned_response)
 
468
  response_text = re.sub(r'<\|system\|>.*?<\|end\|>', '', response_text, flags=re.DOTALL)
469
  response_text = re.sub(r'<\|user\|>.*?<\|end\|>', '', response_text, flags=re.DOTALL)
470
  response_text = re.sub(r'<\|assistant\|>', '', response_text, flags=re.DOTALL)
471
+ #-------
472
+ response_text = re.sub(r'\\u[0-9A-Fa-f]{4}', '', response_text)
473
+ # Add spaces between words and dates (e.g., "born04/04/1963" becomes "born 04/04/1963")
474
+ response_text = re.sub(r'([a-zA-Z])(\d)', r'\1 \2', response_text)
475
+ response_text = re.sub(r'(\d)([a-zA-Z])', r'\1 \2', response_text)
476
+ #--------
477
  # Clean up the text by removing extra whitespace
478
  cleaned_response = response_text.strip()
479
  cleaned_response = re.sub(r'\s+', ' ', cleaned_response)