Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -104,12 +104,12 @@ def split_content(content, chunk_size=32000):
|
|
104 |
|
105 |
def chat_document(file, question):
|
106 |
content = str(read_document(file))
|
107 |
-
content = content.replace('\n', ' ')
|
108 |
-
content = content.replace('\r', ' ')
|
109 |
-
content = content.replace('\t', ' ')
|
110 |
-
content = content.replace(' ', '')
|
111 |
-
content = content.strip()
|
112 |
if len(content) > 32000:
|
|
|
|
|
|
|
|
|
|
|
113 |
content = content[:32000]
|
114 |
|
115 |
# Define system prompt for the chat API
|
|
|
104 |
|
105 |
def chat_document(file, question):
|
106 |
content = str(read_document(file))
|
|
|
|
|
|
|
|
|
|
|
107 |
if len(content) > 32000:
|
108 |
+
content = content.replace('\n', ' ')
|
109 |
+
content = content.replace('\r', ' ')
|
110 |
+
content = content.replace('\t', ' ')
|
111 |
+
content = content.replace(' ', '')
|
112 |
+
content = content.strip()
|
113 |
content = content[:32000]
|
114 |
|
115 |
# Define system prompt for the chat API
|