ljsabc commited on
Commit
5a4ded1
1 Parent(s): 9f2a5e4

Limited the context length for better generation.

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -71,7 +71,7 @@ def evaluate_stream(msg, history, temperature, top_p):
71
  history.append([msg, None])
72
 
73
  context = ""
74
- if len(history) > 8:
75
  history.pop(0)
76
 
77
  for j in range(len(history)):
@@ -123,7 +123,7 @@ with gr.Blocks() as demo:
123
  with gr.Column(scale=3):
124
  chatbot = gr.Chatbot(label="聊天框", info="")
125
  msg = gr.Textbox(label="输入框", placeholder="最近过得怎么样?",
126
- info="输入你的内容,按[Enter]发送。也可以什么都不填写生成随机数据。")
127
  clear = gr.Button("清除聊天")
128
 
129
  msg.submit(evaluate_stream, [msg, chatbot, temp, top_p], [chatbot, msg])
 
71
  history.append([msg, None])
72
 
73
  context = ""
74
+ if len(history) > 4:
75
  history.pop(0)
76
 
77
  for j in range(len(history)):
 
123
  with gr.Column(scale=3):
124
  chatbot = gr.Chatbot(label="聊天框", info="")
125
  msg = gr.Textbox(label="输入框", placeholder="最近过得怎么样?",
126
+ info="输入你的内容,按[Enter]发送。也可以什么都不填写生成随机数据。对话一般不能太长,否则就复读机了,建议清除数据。")
127
  clear = gr.Button("清除聊天")
128
 
129
  msg.submit(evaluate_stream, [msg, chatbot, temp, top_p], [chatbot, msg])