Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -194,6 +194,11 @@ def get_trust_tip_and_suggestion():
|
|
| 194 |
suggestion = random.choice(suggestions)
|
| 195 |
return trust_tip, suggestion
|
| 196 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
|
| 199 |
def side():
|
|
@@ -597,7 +602,7 @@ if prompt :
|
|
| 597 |
#full_response= replace_terms(full_response)
|
| 598 |
|
| 599 |
cleaned_text = clean_text(full_response)
|
| 600 |
-
|
| 601 |
|
| 602 |
#cleaned_text = re.sub(r'</span>', '', cleaned_text)
|
| 603 |
#cleaned_text = re.sub(r'<span[^>]*>', '', cleaned_text)
|
|
|
|
| 194 |
suggestion = random.choice(suggestions)
|
| 195 |
return trust_tip, suggestion
|
| 196 |
|
| 197 |
+
def remove_headings(text):
|
| 198 |
+
# Assuming headings end with a colon ":" and are followed by a space
|
| 199 |
+
return re.sub(r"^[^:]+:\s+", "", text, flags=re.MULTILINE)
|
| 200 |
+
|
| 201 |
+
# Example usage during response generation
|
| 202 |
|
| 203 |
|
| 204 |
def side():
|
|
|
|
| 602 |
#full_response= replace_terms(full_response)
|
| 603 |
|
| 604 |
cleaned_text = clean_text(full_response)
|
| 605 |
+
cleaned_text = remove_headings(cleaned_text)
|
| 606 |
|
| 607 |
#cleaned_text = re.sub(r'</span>', '', cleaned_text)
|
| 608 |
#cleaned_text = re.sub(r'<span[^>]*>', '', cleaned_text)
|