Pijush2023 commited on
Commit
c96f2fe
·
verified ·
1 Parent(s): 9d4befd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -945,6 +945,8 @@ def callback(params):
945
  google = OAuth2Session(client_id, redirect_uri=redirect_uri, state=state)
946
  token = google.fetch_token(token_url, client_secret=client_secret, authorization_response=params)
947
  user_info.update(google.get('https://www.googleapis.com/oauth2/v1/userinfo').json())
 
 
948
  return f"Hello {user_info['name']}! You have successfully logged in."
949
 
950
  def create_gradio_interface():
@@ -953,8 +955,8 @@ def create_gradio_interface():
953
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
954
  state = gr.State({'authenticated': False, 'user_info': {}})
955
 
956
- if user_info:
957
- state.value = {'authenticated': True, 'user_info': user_info}
958
 
959
  def update_interface():
960
  if state.value['authenticated']:
 
945
  google = OAuth2Session(client_id, redirect_uri=redirect_uri, state=state)
946
  token = google.fetch_token(token_url, client_secret=client_secret, authorization_response=params)
947
  user_info.update(google.get('https://www.googleapis.com/oauth2/v1/userinfo').json())
948
+ state['authenticated'] = True
949
+ state['user_info'] = user_info
950
  return f"Hello {user_info['name']}! You have successfully logged in."
951
 
952
  def create_gradio_interface():
 
955
  with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
956
  state = gr.State({'authenticated': False, 'user_info': {}})
957
 
958
+ # if user_info:
959
+ # state.value = {'authenticated': True, 'user_info': user_info}
960
 
961
  def update_interface():
962
  if state.value['authenticated']: