update
Browse files9816 unmodified lines98179818981998209821982298239824982598269816 unmodified lines# Keep the old deploy method as fallback (if not logged in, user can still use the old method)# Optionally, you can keep the old deploy_btn.click for the default method as a secondary button.# Handle login/logout button clicks to update UI# The LoginButton automatically handles OAuth flow, we just need to update UI on clicklogin_button.click(update_ui_for_auth_status,inputs=[],outputs=[input, btn, auth_status],queue=False9816 unmodified lines98179818981998209821982298239824982598269827982898299830983198329833983498359836983798389816 unmodified lines# Keep the old deploy method as fallback (if not logged in, user can still use the old method)# Optionally, you can keep the old deploy_btn.click for the default method as a secondary button.# Handle authentication state updates# The LoginButton automatically handles OAuth flow and passes profile/token to the functiondef handle_auth_update(profile: gr.OAuthProfile | None = None, token: gr.OAuthToken | None = None):return update_ui_for_auth_status(profile, token)# Update UI when login button is clicked (handles both login and logout)login_button.click(handle_auth_update,inputs=[],outputs=[input, btn, auth_status],queue=False)# Also update UI when the page loads in case user is already authenticateddemo.load(handle_auth_update,inputs=[],outputs=[input, btn, auth_status],queue=False
app.py+15-3