Spaces:
Runtime error
Runtime error
Ashhar
commited on
Commit
·
1d4400d
1
Parent(s):
6e0cef4
improved response validation
Browse files
app.py
CHANGED
|
@@ -72,12 +72,12 @@ st.set_page_config(
|
|
| 72 |
|
| 73 |
|
| 74 |
def __isInvalidResponse(response: str):
|
| 75 |
-
if len(re.findall(r'\n((?!http)[a-z])', response)) > 3:
|
| 76 |
U.pprint("new line followed by small case char")
|
| 77 |
return True
|
| 78 |
|
| 79 |
if len(re.findall(r'\b(\w+)(\s+\1){2,}\b', response)) > 1:
|
| 80 |
-
U.pprint("lot of repeating words")
|
| 81 |
return True
|
| 82 |
|
| 83 |
if len(re.findall(r'\n\n', response)) > 20:
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
def __isInvalidResponse(response: str):
|
| 75 |
+
if len(re.findall(r'\n((?!http)[a-z])', response)) > 3 and "```" not in response:
|
| 76 |
U.pprint("new line followed by small case char")
|
| 77 |
return True
|
| 78 |
|
| 79 |
if len(re.findall(r'\b(\w+)(\s+\1){2,}\b', response)) > 1:
|
| 80 |
+
U.pprint("lot of consecutive repeating words")
|
| 81 |
return True
|
| 82 |
|
| 83 |
if len(re.findall(r'\n\n', response)) > 20:
|