K00B404 commited on
Commit
505a5b8
·
verified ·
1 Parent(s): c57a0e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -63,7 +63,8 @@ def chatbot(user_input, history, model_choice):
63
  split_res = response.split("<|assistant|>")
64
  final_response = split_res[-1].strip() if len(split_res) > 1 else response
65
 
66
- history.append((user_input, final_response))
 
67
  return "", history
68
 
69
  with gr.Blocks() as demo:
@@ -72,7 +73,7 @@ with gr.Blocks() as demo:
72
  with gr.Row():
73
  model_choice = gr.Dropdown(label="Select Model", choices=premium_models, value=premium_models[0])
74
 
75
- chatbot_ui = gr.Chatbot()
76
  user_input = gr.Textbox(show_label=False, placeholder="Type your message and press Enter")
77
  clear_btn = gr.Button("Clear")
78
 
 
63
  split_res = response.split("<|assistant|>")
64
  final_response = split_res[-1].strip() if len(split_res) > 1 else response
65
 
66
+ history.append({"role": "user", "content": user_input})
67
+ history.append({"role": "assistant", "content": final_response})
68
  return "", history
69
 
70
  with gr.Blocks() as demo:
 
73
  with gr.Row():
74
  model_choice = gr.Dropdown(label="Select Model", choices=premium_models, value=premium_models[0])
75
 
76
+ chatbot_ui = gr.Chatbot(type="messages")
77
  user_input = gr.Textbox(show_label=False, placeholder="Type your message and press Enter")
78
  clear_btn = gr.Button("Clear")
79