Antoine245 commited on
Commit
7ddaf2b
·
1 Parent(s): 612c776

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -23,7 +23,7 @@ examples = [
23
  ]
24
 
25
  # user_message = ['']
26
- # history = ['']
27
 
28
 
29
  with gr.Blocks() as demo:
@@ -33,14 +33,15 @@ with gr.Blocks() as demo:
33
 
34
  def user(user_message, history):
35
  return gr.update(value="", interactive=False), history + [[user_message,None]]
36
- def bot(user_message, history):
37
  # chat_history.append(message) # Initialize chat history
38
- history[-1][1] = ""
39
  bot_message = palm.chat(
40
  context=context,
41
  examples=examples,
42
- messages=user_message
43
  )
 
44
  for character in bot_message:
45
  history[-1][1] += character
46
  time.sleep(0.05)
 
23
  ]
24
 
25
  # user_message = ['']
26
+ history = ['']
27
 
28
 
29
  with gr.Blocks() as demo:
 
33
 
34
  def user(user_message, history):
35
  return gr.update(value="", interactive=False), history + [[user_message,None]]
36
+ def bot(history):
37
  # chat_history.append(message) # Initialize chat history
38
+
39
  bot_message = palm.chat(
40
  context=context,
41
  examples=examples,
42
+ messages=history
43
  )
44
+ history[-1][1] = ""
45
  for character in bot_message:
46
  history[-1][1] += character
47
  time.sleep(0.05)