npc0 commited on
Commit
5c5a2c6
·
verified ·
1 Parent(s): eb06ca3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -37,10 +37,11 @@ def sum_chain_l1(text, p_bar):
37
  t = text[i*8000:i*8000+8196]
38
  if len(t) > 0:
39
  for answer in pipeline.chat(
40
- chatglm_cpp.ChatMessage(role="user",
41
- content=prompt+t),
 
42
  stream=True):
43
- yield f"{'='*8} {i+1}/{len(text)//8000+1} {'='*8}\n{answer}"
44
  docs.append(answer)
45
  yield docs
46
 
@@ -50,10 +51,11 @@ def sum_chain_l2_deprecated(docs, p_bar):
50
  for doc in p_bar(docs[1:]):
51
  i += 1
52
  for answer in pipeline.chat(
53
- chatglm_cpp.ChatMessage(role="user",
54
- content=prompt+"\n"+hist+"\n"+doc),
 
55
  stream=True):
56
- yield f"{'='*8} {i}/{len(docs)} {'='*8}\n{answer}"
57
  hist = answer
58
  yield hist
59
 
 
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
+ yield f"{'='*8} {i+1}/{len(text)//8000+1} {'='*8}\n{answer.content}"
45
  docs.append(answer)
46
  yield docs
47
 
 
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
+ yield f"{'='*8} {i}/{len(docs)} {'='*8}\n{answer.content}"
59
  hist = answer
60
  yield hist
61