multimodalart HF Staff commited on
Commit
4f9dc02
·
verified ·
1 Parent(s): 3dcd4c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  import fal_client
 
3
  import os
4
  from typing import Optional
5
 
@@ -109,12 +110,16 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
109
  outputs=[multi_image_output],
110
  )
111
 
112
- def show_app_on_login(profile: Optional[gr.OAuthProfile] = None):
113
  """
114
  Controls the visibility of the main UI.
115
  Gradio automatically injects `gr.OAuthProfile` if the user is logged in.
116
  """
 
117
  if profile:
 
 
 
118
  return gr.update(visible=True)
119
  return gr.update(visible=False)
120
 
 
1
  import gradio as gr
2
  import fal_client
3
+ from huggingface_hub import whoami
4
  import os
5
  from typing import Optional
6
 
 
110
  outputs=[multi_image_output],
111
  )
112
 
113
+ def show_app_on_login(profile: Optional[gr.OAuthProfile] = None, oauth_token: gr.OAuthToken = None):
114
  """
115
  Controls the visibility of the main UI.
116
  Gradio automatically injects `gr.OAuthProfile` if the user is logged in.
117
  """
118
+
119
  if profile:
120
+ print(profile)
121
+ user = whoami(token=oauth_token.token)
122
+ print(user)
123
  return gr.update(visible=True)
124
  return gr.update(visible=False)
125