InnovisionLLC commited on
Commit
436fe78
·
verified ·
1 Parent(s): 86893a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -6
app.py CHANGED
@@ -909,13 +909,25 @@ class ChatbotUI:
909
  msg = gr.Textbox(label="Ask me anything", placeholder="Log in to start chatting", interactive=False)
910
 
911
 
912
- def get_auth_id(oauth_token: gr.OAuthToken | None) -> str:
913
- if oauth_token is None:
914
- return None
915
- id = whoami(oauth_token.token)['id']
916
- return id
917
 
918
-
 
 
 
 
 
 
 
 
 
 
 
 
919
 
920
 
921
 
 
909
  msg = gr.Textbox(label="Ask me anything", placeholder="Log in to start chatting", interactive=False)
910
 
911
 
912
+ # def get_auth_id(oauth_token: gr.OAuthToken | None) -> str:
913
+ # if oauth_token is None:
914
+ # return None
915
+ # id = whoami(oauth_token.token)['id']
916
+ # return id
917
 
918
+ def get_auth_id(oauth_token: gr.OAuthToken | None) -> str | None:
919
+
920
+ print(oauth_token)
921
+ if oauth_token is None:
922
+ return None
923
+
924
+ try:
925
+ user_info = whoami(oauth_token.token)
926
+ print(user_info)
927
+ return user_info.get('id')
928
+ except Exception as e:
929
+ print(f"Authentication failed: {e}")
930
+ return None
931
 
932
 
933