AjithKSenthil commited on
Commit
d9aac70
·
verified ·
1 Parent(s): f10ccac

Update chatbot.py

Browse files
Files changed (1) hide show
  1. chatbot.py +3 -3
chatbot.py CHANGED
@@ -142,6 +142,7 @@ with gr.Blocks() as demo:
142
  login_button = gr.Button("Login")
143
  register_button = gr.Button("Register")
144
  user_id_state = gr.State()
 
145
 
146
  chat_input = gr.Textbox(lines=7, label="Chat with AttachmentBot")
147
  chat_output = gr.Textbox(label="Conversation")
@@ -161,8 +162,8 @@ with gr.Blocks() as demo:
161
  else:
162
  return gr.update(visible=False), None, "Registration failed, try a different username."
163
 
164
- login_button.click(login, inputs=[username, password], outputs=[gr.update(visible=True), user_id_state, gr.Textbox(visible=False)])
165
- register_button.click(register, inputs=[username, password], outputs=[gr.update(visible=True), user_id_state, gr.Textbox(visible=False)])
166
 
167
  chat_interface = gr.Interface(
168
  fn=chatbot,
@@ -170,7 +171,6 @@ with gr.Blocks() as demo:
170
  outputs=[chat_output, state],
171
  title="AttachmentBot",
172
  description="Let me survey you about your attachment with certain people in your life. To begin, enter 'start'.",
173
- visible=False # Initially hidden, shown after login
174
  )
175
 
176
  demo.launch()
 
142
  login_button = gr.Button("Login")
143
  register_button = gr.Button("Register")
144
  user_id_state = gr.State()
145
+ auth_message = gr.Textbox(visible=False)
146
 
147
  chat_input = gr.Textbox(lines=7, label="Chat with AttachmentBot")
148
  chat_output = gr.Textbox(label="Conversation")
 
162
  else:
163
  return gr.update(visible=False), None, "Registration failed, try a different username."
164
 
165
+ login_button.click(login, inputs=[username, password], outputs=[chat_input, user_id_state, auth_message])
166
+ register_button.click(register, inputs=[username, password], outputs=[chat_input, user_id_state, auth_message])
167
 
168
  chat_interface = gr.Interface(
169
  fn=chatbot,
 
171
  outputs=[chat_output, state],
172
  title="AttachmentBot",
173
  description="Let me survey you about your attachment with certain people in your life. To begin, enter 'start'.",
 
174
  )
175
 
176
  demo.launch()