Zedel17 commited on
Commit
9a99f4f
·
1 Parent(s): 36c9852

Gradio fix

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -119,7 +119,9 @@ with gr.Blocks() as demo:
119
 
120
  def respond(message, chat_history):
121
  reply = chat_fn(message, chat_history)
122
- chat_history.append((message, reply))
 
 
123
  return "", chat_history
124
 
125
  send_btn.click(respond, [msg, chatbot], [msg, chatbot])
 
119
 
120
  def respond(message, chat_history):
121
  reply = chat_fn(message, chat_history)
122
+ # Gradio expects messages format with role/content
123
+ chat_history.append({"role": "user", "content": message})
124
+ chat_history.append({"role": "assistant", "content": reply})
125
  return "", chat_history
126
 
127
  send_btn.click(respond, [msg, chatbot], [msg, chatbot])