Spaces:
Running
Running
Update ui_components.py
Browse files- ui_components.py +4 -8
ui_components.py
CHANGED
@@ -107,10 +107,8 @@ class UIComponents:
|
|
107 |
"""Create HuggingFace OAuth login section"""
|
108 |
with gr.Group(elem_classes="login-section"):
|
109 |
gr.Markdown("## π Authentication", container=True)
|
110 |
-
self.login_status = gr.Markdown("Please sign in to access Inference Providers", container=True)
|
111 |
self.login_button = gr.LoginButton(
|
112 |
-
value="Sign in
|
113 |
-
size="sm",
|
114 |
redirect_url="https://gradio-chat-gradio-app-hfips.hf.space/"
|
115 |
)
|
116 |
|
@@ -238,7 +236,7 @@ class UIComponents:
|
|
238 |
# OAuth profile handler
|
239 |
def handle_oauth_profile(profile: gr.OAuthProfile | None, token: gr.OAuthToken | None):
|
240 |
if profile is None:
|
241 |
-
return
|
242 |
|
243 |
logger.info(f"π€ OAuth profile received for user: {profile.name}")
|
244 |
|
@@ -253,9 +251,7 @@ class UIComponents:
|
|
253 |
logger.info("β
HuggingFace Inference client updated with OAuth token")
|
254 |
except Exception as e:
|
255 |
logger.error(f"β Failed to update HF client: {e}")
|
256 |
-
|
257 |
-
return f"<small>β
Signed in as: <strong>{profile.name}</strong></small>"
|
258 |
-
|
259 |
# Provider selection with auto-model loading
|
260 |
def handle_provider_change(provider_id):
|
261 |
if not provider_id:
|
@@ -423,7 +419,7 @@ class UIComponents:
|
|
423 |
# Connect OAuth
|
424 |
demo.load(
|
425 |
fn=handle_oauth_profile,
|
426 |
-
outputs=[
|
427 |
)
|
428 |
|
429 |
# Connect provider/model dropdowns with auto-selection on load
|
|
|
107 |
"""Create HuggingFace OAuth login section"""
|
108 |
with gr.Group(elem_classes="login-section"):
|
109 |
gr.Markdown("## π Authentication", container=True)
|
|
|
110 |
self.login_button = gr.LoginButton(
|
111 |
+
value="Sign in for Inference",
|
|
|
112 |
redirect_url="https://gradio-chat-gradio-app-hfips.hf.space/"
|
113 |
)
|
114 |
|
|
|
236 |
# OAuth profile handler
|
237 |
def handle_oauth_profile(profile: gr.OAuthProfile | None, token: gr.OAuthToken | None):
|
238 |
if profile is None:
|
239 |
+
return
|
240 |
|
241 |
logger.info(f"π€ OAuth profile received for user: {profile.name}")
|
242 |
|
|
|
251 |
logger.info("β
HuggingFace Inference client updated with OAuth token")
|
252 |
except Exception as e:
|
253 |
logger.error(f"β Failed to update HF client: {e}")
|
254 |
+
|
|
|
|
|
255 |
# Provider selection with auto-model loading
|
256 |
def handle_provider_change(provider_id):
|
257 |
if not provider_id:
|
|
|
419 |
# Connect OAuth
|
420 |
demo.load(
|
421 |
fn=handle_oauth_profile,
|
422 |
+
outputs=[]
|
423 |
)
|
424 |
|
425 |
# Connect provider/model dropdowns with auto-selection on load
|