mou3az commited on
Commit
adef813
1 Parent(s): 9a921ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -203,8 +203,7 @@ messages1_state = [
203
  AIMessage(content="I'm great thank you. How can I help you?")]
204
 
205
 
206
- def Chat_Message(history):
207
- messages1 = gr.State(messages1_state)
208
 
209
  message=HumanMessage(content=history[-1][0])
210
  messages1.append(message)
@@ -451,6 +450,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
451
  gr.Markdown("""<div style='margin-left: -120px;'><span style='font-weight: bold; color: blue; font-size: xx-large;'>IT ASSISTANT</span></div>""")
452
 
453
  with gr.Tab("Chat-Message"):
 
454
  chatbot = gr.Chatbot(
455
  [],
456
  elem_id="chatbot",
@@ -464,8 +464,8 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
464
 
465
  clear = gr.ClearButton([msg, chatbot])
466
 
467
- msg.submit(user, [msg, chatbot], [msg, chatbot], queue=True).then(Chat_Message, chatbot, chatbot)
468
- submit.click(user, [msg, chatbot], [msg, chatbot], queue=True).then(Chat_Message, chatbot, chatbot)
469
  chatbot.like(print_like_dislike, None, None)
470
 
471
  with gr.Tab("Internet-Search"):
 
203
  AIMessage(content="I'm great thank you. How can I help you?")]
204
 
205
 
206
+ def Chat_Message(history, messages1):
 
207
 
208
  message=HumanMessage(content=history[-1][0])
209
  messages1.append(message)
 
450
  gr.Markdown("""<div style='margin-left: -120px;'><span style='font-weight: bold; color: blue; font-size: xx-large;'>IT ASSISTANT</span></div>""")
451
 
452
  with gr.Tab("Chat-Message"):
453
+ messages1=gr.State(messages1_state)
454
  chatbot = gr.Chatbot(
455
  [],
456
  elem_id="chatbot",
 
464
 
465
  clear = gr.ClearButton([msg, chatbot])
466
 
467
+ msg.submit(user, [msg, chatbot], [msg, chatbot], queue=True).then(Chat_Message, [chatbot, messages1], [chatbot, messages1])
468
+ submit.click(user, [msg, chatbot], [msg, chatbot], queue=True).then(Chat_Message, [chatbot, messages1], [chatbot, messages1])
469
  chatbot.like(print_like_dislike, None, None)
470
 
471
  with gr.Tab("Internet-Search"):