Sensei13k commited on
Commit
32b2f60
·
verified ·
1 Parent(s): 0335d8f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -339,12 +339,12 @@ def create_interface():
339
  with gr.Row():
340
  with gr.Column(scale=4):
341
  chatbot = gr.Chatbot(
342
- value=[[None, get_welcome_message()]],
343
  height=500,
344
- bubble_full_width=False,
345
  show_label=False,
346
  container=True,
347
- avatar_images=("👤", "🤖")
 
348
  )
349
 
350
  with gr.Row():
@@ -412,12 +412,13 @@ def create_interface():
412
  return chat_history, ""
413
 
414
  bot_message = process_message(message, chat_history, model_name)
415
- chat_history.append([message, bot_message])
 
416
  return chat_history, ""
417
 
418
  def clear_chat():
419
  reset_conversation()
420
- return [[None, get_welcome_message()]], ""
421
 
422
  # Wire up the events
423
  msg.submit(respond, [msg, chatbot, model_selector], [chatbot, msg])
@@ -447,7 +448,6 @@ def main():
447
  server_port=7860, # Default Gradio port
448
  share=False, # Set to True to create public link
449
  show_error=True,
450
- show_tips=True,
451
  enable_queue=True,
452
  max_threads=10
453
  )
 
339
  with gr.Row():
340
  with gr.Column(scale=4):
341
  chatbot = gr.Chatbot(
342
+ value=[{"role": "assistant", "content": get_welcome_message()}],
343
  height=500,
 
344
  show_label=False,
345
  container=True,
346
+ avatar_images=("👤", "🤖"),
347
+ type="messages"
348
  )
349
 
350
  with gr.Row():
 
412
  return chat_history, ""
413
 
414
  bot_message = process_message(message, chat_history, model_name)
415
+ chat_history.append({"role": "user", "content": message})
416
+ chat_history.append({"role": "assistant", "content": bot_message})
417
  return chat_history, ""
418
 
419
  def clear_chat():
420
  reset_conversation()
421
+ return [{"role": "assistant", "content": get_welcome_message()}], ""
422
 
423
  # Wire up the events
424
  msg.submit(respond, [msg, chatbot, model_selector], [chatbot, msg])
 
448
  server_port=7860, # Default Gradio port
449
  share=False, # Set to True to create public link
450
  show_error=True,
 
451
  enable_queue=True,
452
  max_threads=10
453
  )