Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -83,10 +83,6 @@ def chat_document(file, question):
|
|
83 |
content = str(read_document(file))
|
84 |
if len(content) > 32000:
|
85 |
content = content[:32000]
|
86 |
-
content = content.replace('\n', ' ')
|
87 |
-
content = content.replace('\r', ' ')
|
88 |
-
content = content.replace('\t', ' ')
|
89 |
-
content = content.strip()
|
90 |
|
91 |
# Define system prompt for the chat API
|
92 |
system_prompt = """
|
@@ -111,10 +107,6 @@ def chat_document(file, question):
|
|
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 |
|
119 |
chunks = split_content(content)
|
120 |
|
@@ -151,7 +143,7 @@ def chat_document_v2(file, question):
|
|
151 |
|
152 |
all_answers_str = "\n".join(all_answers)
|
153 |
print(all_answers_str)
|
154 |
-
summary_message = f"""[INST] {summary_prompt}
|
155 |
{all_answers_str[:30000]}
|
156 |
Summary:"""
|
157 |
|
|
|
83 |
content = str(read_document(file))
|
84 |
if len(content) > 32000:
|
85 |
content = content[:32000]
|
|
|
|
|
|
|
|
|
86 |
|
87 |
# Define system prompt for the chat API
|
88 |
system_prompt = """
|
|
|
107 |
|
108 |
def chat_document_v2(file, question):
|
109 |
content = str(read_document(file))
|
|
|
|
|
|
|
|
|
110 |
|
111 |
chunks = split_content(content)
|
112 |
|
|
|
143 |
|
144 |
all_answers_str = "\n".join(all_answers)
|
145 |
print(all_answers_str)
|
146 |
+
summary_message = f"""[INST] [SYSTEM] {summary_prompt}
|
147 |
{all_answers_str[:30000]}
|
148 |
Summary:"""
|
149 |
|