blanchon commited on
Commit
16dc987
·
1 Parent(s): c603424

log user 4

Browse files
Files changed (1) hide show
  1. app.py +8 -11
app.py CHANGED
@@ -201,9 +201,9 @@ with gr.Blocks(title="PixDiet", theme=gr.themes.Ocean()) as demo:
201
  chatbot = gr.Chatbot(label="Chat with PixDiet", layout="panel", height=600, show_copy_button=True, latex_delimiters=latex_delimiters_set)
202
  text_input = gr.Textbox(label="Ask about your meal", placeholder="(Optional) Enter your message here...", lines=1, container=False)
203
  with gr.Row():
204
- send_btn = gr.Button("Send", variant="primary", visible=False)
205
  login_button = LoginButton(visible=True)
206
- clear_btn = gr.Button("Delete my historic", variant="stop", visible=False)
207
 
208
  def submit_chat(chatbot, text_input):
209
  response = ''
@@ -221,21 +221,18 @@ with gr.Blocks(title="PixDiet", theme=gr.themes.Ocean()) as demo:
221
  print("login")
222
  print(data)
223
 
 
 
 
 
 
224
  if user is not None:
225
- profile = get_profile(user)
226
- print(profile)
227
- USER_ID = profile["username"]
228
- print(f"User logged in: {USER_ID}")
229
  else:
230
  USER_ID = "john doe"
231
 
232
  IS_LOGGED_IN = True
233
 
234
- return (
235
- gr.update(visible=not IS_LOGGED_IN),
236
- gr.update(visible=IS_LOGGED_IN),
237
- gr.update(visible=IS_LOGGED_IN)
238
- )
239
 
240
  def get_profile(profile) -> dict:
241
  print(profile.__dict__)
 
201
  chatbot = gr.Chatbot(label="Chat with PixDiet", layout="panel", height=600, show_copy_button=True, latex_delimiters=latex_delimiters_set)
202
  text_input = gr.Textbox(label="Ask about your meal", placeholder="(Optional) Enter your message here...", lines=1, container=False)
203
  with gr.Row():
204
+ send_btn = gr.Button("Send", variant="primary", visible=True)
205
  login_button = LoginButton(visible=True)
206
+ clear_btn = gr.Button("Delete my historic", variant="stop", visible=True)
207
 
208
  def submit_chat(chatbot, text_input):
209
  response = ''
 
221
  print("login")
222
  print(data)
223
 
224
+ profile = get_profile(user)
225
+ print(profile)
226
+ user = profile["username"]
227
+ print(f"User logged in: {USER_ID}")
228
+
229
  if user is not None:
230
+ USER_ID = user
 
 
 
231
  else:
232
  USER_ID = "john doe"
233
 
234
  IS_LOGGED_IN = True
235
 
 
 
 
 
 
236
 
237
  def get_profile(profile) -> dict:
238
  print(profile.__dict__)