Spaces:
No application file
No application file
Update test.py
Browse files
test.py
CHANGED
|
@@ -1,7 +1,17 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
import re
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Function to parse tables from the response
|
| 7 |
def parse_tables(response_text):
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
import re
|
| 3 |
|
| 4 |
+
def clean_llm_response(text):
|
| 5 |
+
# Remove lines with '--- | --- | ---' pattern
|
| 6 |
+
clean_text = re.sub(r'---(\s*\|\s*---)+', '', text)
|
| 7 |
+
|
| 8 |
+
# Remove lines containing '**'
|
| 9 |
+
clean_text = re.sub(r'\*\*.*\*\*', '', clean_text)
|
| 10 |
+
|
| 11 |
+
# Remove any resulting empty lines
|
| 12 |
+
clean_text = re.sub(r'\n\s*\n', '\n', clean_text)
|
| 13 |
+
|
| 14 |
+
return clean_text
|
| 15 |
|
| 16 |
# Function to parse tables from the response
|
| 17 |
def parse_tables(response_text):
|