KingNish commited on
Commit
eff0b10
·
verified ·
1 Parent(s): a43ac05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -81,6 +81,10 @@ def split_content(content, chunk_size=32000):
81
 
82
  def chat_document(file, question):
83
  content = str(read_document(file))
 
 
 
 
84
  if len(content) > 32000:
85
  content = content[:32000]
86
 
@@ -107,7 +111,10 @@ def chat_document(file, question):
107
 
108
  def chat_document_v2(file, question):
109
  content = str(read_document(file))
110
-
 
 
 
111
  chunks = split_content(content)
112
 
113
  # Define system prompt for the chat API
 
81
 
82
  def chat_document(file, question):
83
  content = str(read_document(file))
84
+ content = content.replace('\n', ' ')
85
+ content = content.replace('\r', ' ')
86
+ content = content.replace('\t', ' ')
87
+ content = content.strip()
88
  if len(content) > 32000:
89
  content = content[:32000]
90
 
 
111
 
112
  def chat_document_v2(file, question):
113
  content = str(read_document(file))
114
+ content = content.replace('\n', ' ')
115
+ content = content.replace('\r', ' ')
116
+ content = content.replace('\t', ' ')
117
+ content = content.strip()
118
  chunks = split_content(content)
119
 
120
  # Define system prompt for the chat API