Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -36,12 +36,14 @@ def sum_chain_l1(text, p_bar):
|
|
| 36 |
for i in p_bar(range(len(text)//8000+1)):
|
| 37 |
t = text[i*8000:i*8000+8196]
|
| 38 |
if len(t) > 0:
|
|
|
|
| 39 |
for answer in pipeline.chat(
|
| 40 |
[chatglm_cpp.ChatMessage(
|
| 41 |
role="user",
|
| 42 |
content=prompt+t)],
|
| 43 |
stream=True):
|
| 44 |
-
|
|
|
|
| 45 |
docs.append(answer)
|
| 46 |
yield docs
|
| 47 |
|
|
@@ -50,12 +52,14 @@ def sum_chain_l2_deprecated(docs, p_bar):
|
|
| 50 |
i = 0
|
| 51 |
for doc in p_bar(docs[1:]):
|
| 52 |
i += 1
|
|
|
|
| 53 |
for answer in pipeline.chat(
|
| 54 |
[chatglm_cpp.ChatMessage(
|
| 55 |
role="user",
|
| 56 |
content=prompt+"\n"+hist+"\n"+doc)],
|
| 57 |
stream=True):
|
| 58 |
-
|
|
|
|
| 59 |
hist = answer
|
| 60 |
yield hist
|
| 61 |
|
|
|
|
| 36 |
for i in p_bar(range(len(text)//8000+1)):
|
| 37 |
t = text[i*8000:i*8000+8196]
|
| 38 |
if len(t) > 0:
|
| 39 |
+
a = ''
|
| 40 |
for answer in pipeline.chat(
|
| 41 |
[chatglm_cpp.ChatMessage(
|
| 42 |
role="user",
|
| 43 |
content=prompt+t)],
|
| 44 |
stream=True):
|
| 45 |
+
a += answer.content
|
| 46 |
+
yield f"{'='*8} {i+1}/{len(text)//8000+1} {'='*8}\n{a}"
|
| 47 |
docs.append(answer)
|
| 48 |
yield docs
|
| 49 |
|
|
|
|
| 52 |
i = 0
|
| 53 |
for doc in p_bar(docs[1:]):
|
| 54 |
i += 1
|
| 55 |
+
a = ''
|
| 56 |
for answer in pipeline.chat(
|
| 57 |
[chatglm_cpp.ChatMessage(
|
| 58 |
role="user",
|
| 59 |
content=prompt+"\n"+hist+"\n"+doc)],
|
| 60 |
stream=True):
|
| 61 |
+
a += answer.content
|
| 62 |
+
yield f"{'='*8} {i}/{len(docs)} {'='*8}\n{a}"
|
| 63 |
hist = answer
|
| 64 |
yield hist
|
| 65 |
|