zahraa12355 commited on
Commit
b76f492
·
verified ·
1 Parent(s): 821d10c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
app.py CHANGED
@@ -101,19 +101,16 @@ def process_input(user_input, history):
101
  # Get the updated history and bot response
102
  updated_history, _ = respond(user_input, history)
103
 
104
- # Save the updated chat history
105
  save_chat(updated_history)
106
 
107
- # Return the updated history for the chatbot display and an empty string for the textbox
108
- return updated_history, "", updated_history # Also return updated history for the state
109
 
110
  with gr.Blocks() as demo:
111
  chatbot = gr.Chatbot()
112
  msg = gr.Textbox(placeholder="Type your message here...")
113
- state = gr.State([]) # This state variable holds the chat history
114
 
115
- # Update the submit action to call the new function
116
- # Add 'msg' to the outputs so its value can be updated
117
  msg.submit(process_input, inputs=[msg, state], outputs=[chatbot, msg, state])
118
-
119
  demo.launch()
 
101
  # Get the updated history and bot response
102
  updated_history, _ = respond(user_input, history)
103
 
 
104
  save_chat(updated_history)
105
 
106
+
107
+ return updated_history, "", updated_history
108
 
109
  with gr.Blocks() as demo:
110
  chatbot = gr.Chatbot()
111
  msg = gr.Textbox(placeholder="Type your message here...")
112
+ state = gr.State([])
113
 
114
+
 
115
  msg.submit(process_input, inputs=[msg, state], outputs=[chatbot, msg, state])
 
116
  demo.launch()