Pijush2023 commited on
Commit
7e40505
·
verified ·
1 Parent(s): a799bca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -549,13 +549,12 @@ def clean_response(response_text):
549
  # Remove any unwanted escape characters like \u and \u00
550
  response_text = re.sub(r'\\u[0-9A-Fa-f]{4}', '', response_text)
551
 
552
- # Add spaces between words and dates
553
- response_text = re.sub(r'([a-zA-Z])(\d)', r'\1 \2', response_text) # Add space between letter and number
554
- response_text = re.sub(r'(\d)([a-zA-Z])', r'\1 \2', response_text) # Add space between number and letter
555
- response_text = re.sub(r'([A-Z])([A-Z][a-z])', r'\1 \2', response_text) # Add space between capital letters and words
556
 
557
- # Remove the phrase "Sure! The Responses are as follows:" from the actual content
558
- response_text = re.sub(r'Sure! The Responses are as follows:', '', response_text).strip()
559
 
560
  # Clean up the text by removing extra whitespace
561
  cleaned_response = re.sub(r'\s+', ' ', response_text).strip()
@@ -577,6 +576,7 @@ Sure! The Responses are as follows:
577
 
578
 
579
 
 
580
  # Define a new template specifically for GPT-4o-mini in VDB Details mode
581
  gpt4o_mini_template_details = f"""
582
  As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.
 
549
  # Remove any unwanted escape characters like \u and \u00
550
  response_text = re.sub(r'\\u[0-9A-Fa-f]{4}', '', response_text)
551
 
552
+ # Insert spaces between letters and numbers
553
+ response_text = re.sub(r'([a-zA-Z])(\d)', r'\1 \2', response_text) # Letter followed by a number
554
+ response_text = re.sub(r'(\d)([a-zA-Z])', r'\1 \2', response_text) # Number followed by a letter
 
555
 
556
+ # Ensure spaces between words, even when run together (e.g., between lowercase and uppercase letters)
557
+ response_text = re.sub(r'([a-z])([A-Z])', r'\1 \2', response_text) # Insert space between lowercase and uppercase letters
558
 
559
  # Clean up the text by removing extra whitespace
560
  cleaned_response = re.sub(r'\s+', ' ', response_text).strip()
 
576
 
577
 
578
 
579
+
580
  # Define a new template specifically for GPT-4o-mini in VDB Details mode
581
  gpt4o_mini_template_details = f"""
582
  As a highly specialized assistant, I provide precise, detailed, and informative responses. On this bright day of {current_date}, I'm equipped to assist with all your queries about Birmingham, Alabama, offering detailed insights tailored to your needs.