chansung commited on
Commit
6c1ea0a
·
1 Parent(s): 75861c9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -12
app.py CHANGED
@@ -243,8 +243,8 @@ examples = [
243
  ]
244
  ex_btns = []
245
 
246
- def reset_chat(idx, ld, state):
247
- res = [state["ppmanager_type"].from_json(json.dumps(ppm_str)) for ppm_str in ld]
248
  res[idx].pingpongs = []
249
 
250
  return (
@@ -269,19 +269,14 @@ That said, the assistant is practical and really does its best, and doesn’t le
269
  return CtxLastWindowStrategy(3)(dummy_ppm)
270
 
271
  def add_pingpong(idx, ld, ping):
272
- res = [
273
- GradioAlpacaChatPPManager.from_json(json.dumps(ppm))
274
- for ppm in ld
275
- ]
276
-
277
  ppm = res[idx]
 
278
  ppm.add_pingpong(
279
  PingPong(ping, "")
280
  )
281
- prompt = build_prompts(ppm)
282
- print(prompt)
283
-
284
- prompt = tf.constant(prompt)
285
  max_length = tf.constant(256, dtype="int64")
286
 
287
  result = gpt_lm_predict_fn(
@@ -397,7 +392,7 @@ with gr.Blocks(css=STYLE, elem_id='container-col') as demo:
397
 
398
  clean.click(
399
  reset_chat,
400
- [idx, local_data, chat_state],
401
  [instruction_txtbox, chatbot, local_data, example_block, regenerate]
402
  ).then(
403
  None, local_data, None,
 
243
  ]
244
  ex_btns = []
245
 
246
+ def reset_chat(idx, ld):
247
+ res = [GradioAlpacaChatPPManager.from_json(json.dumps(ppm)) for ppm in ld]
248
  res[idx].pingpongs = []
249
 
250
  return (
 
269
  return CtxLastWindowStrategy(3)(dummy_ppm)
270
 
271
  def add_pingpong(idx, ld, ping):
272
+ res = [GradioAlpacaChatPPManager.from_json(json.dumps(ppm)) for ppm in ld]
 
 
 
 
273
  ppm = res[idx]
274
+
275
  ppm.add_pingpong(
276
  PingPong(ping, "")
277
  )
278
+
279
+ prompt = tf.constant(build_prompts(ppm))
 
 
280
  max_length = tf.constant(256, dtype="int64")
281
 
282
  result = gpt_lm_predict_fn(
 
392
 
393
  clean.click(
394
  reset_chat,
395
+ [idx, local_data],
396
  [instruction_txtbox, chatbot, local_data, example_block, regenerate]
397
  ).then(
398
  None, local_data, None,