JoaquinVanschoren commited on
Commit
8bd04dd
·
1 Parent(s): 59a4389

login fix

Browse files
Files changed (1) hide show
  1. app.py +8 -21
app.py CHANGED
@@ -103,28 +103,15 @@ def create_ui():
103
  "If your dataset is hosted on Hugging Face, log in first. "
104
  "This avoids rate limiting issues and allows you to fetch gated datasets. "
105
  "If your dataset is not on Hugging Face, you can still use the validator without logging in.</p>")
106
- gr.LoginButton(elem_classes=["login-button"])
107
  gr.HTML("""
108
- <script>
109
- (function() {
110
- function patchLoginButton() {
111
- document.querySelectorAll('.login-button button').forEach(function(btn) {
112
- if (btn.dataset.oauthPatched) return;
113
- btn.dataset.oauthPatched = '1';
114
- btn.addEventListener('click', function(e) {
115
- e.preventDefault();
116
- e.stopImmediatePropagation();
117
- var targetUrl = window.location.pathname + (window.location.search || '');
118
- window.open('/login?_target_url=' + encodeURIComponent(targetUrl), '_blank');
119
- }, true);
120
- });
121
- }
122
- var observer = new MutationObserver(patchLoginButton);
123
- observer.observe(document.body, {childList: true, subtree: true});
124
- patchLoginButton();
125
- setTimeout(patchLoginButton, 1000);
126
- })();
127
- </script>
128
  """)
129
 
130
  # Track the active tab for conditional UI updates
 
103
  "If your dataset is hosted on Hugging Face, log in first. "
104
  "This avoids rate limiting issues and allows you to fetch gated datasets. "
105
  "If your dataset is not on Hugging Face, you can still use the validator without logging in.</p>")
 
106
  gr.HTML("""
107
+ <div style="display:flex; justify-content:center; margin-top:4px;">
108
+ <a href="/login?_target_url=/" target="_blank" rel="noopener noreferrer"
109
+ style="display:inline-flex; align-items:center; gap:8px; padding:8px 20px;
110
+ background:white; color:black; border:1px solid #ccc; border-radius:6px;
111
+ text-decoration:none; font-size:14px; font-weight:500; cursor:pointer;">
112
+ Sign in with Hugging Face
113
+ </a>
114
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
115
  """)
116
 
117
  # Track the active tab for conditional UI updates