wuhp commited on
Commit
17e2ef6
·
verified ·
1 Parent(s): 290b24f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -103,13 +103,13 @@ with gr.Blocks(title="Gemini → HF Space scaffolder") as demo:
103
  login_btn = gr.LoginButton(variant="huggingface", size="lg") # displays "Sign in with Hugging Face"
104
  status_md = gr.Markdown("*Not logged in.*")
105
 
106
- # Wire up login flow: update status on load and when button is clicked
107
  def show_profile(profile: gr.OAuthProfile | None) -> str:
108
  return "*Not logged in.*" if profile is None else f"Logged in as **{profile.username}**"
109
 
110
- # Trigger on page load and on login button click
111
- demo.load(fn=show_profile, inputs=login_btn, outputs=[status_md])
112
- login_btn.click(fn=show_profile, inputs=login_btn, outputs=[status_md])
113
 
114
  with gr.Row():
115
  with gr.Column(scale=1):
 
103
  login_btn = gr.LoginButton(variant="huggingface", size="lg") # displays "Sign in with Hugging Face"
104
  status_md = gr.Markdown("*Not logged in.*")
105
 
106
+ # 2) show_profile called on load & login/logout
107
  def show_profile(profile: gr.OAuthProfile | None) -> str:
108
  return "*Not logged in.*" if profile is None else f"Logged in as **{profile.username}**"
109
 
110
+ # Trigger on page load and when login button is clicked
111
+ demo.load(fn=show_profile, inputs=None, outputs=[status_md])
112
+ login_btn.click(fn=show_profile, inputs=None, outputs=[status_md])
113
 
114
  with gr.Row():
115
  with gr.Column(scale=1):