Spaces:
Sleeping
Sleeping
rebaseline07_23Sept25_05 - HF logout. Handle exception docconverter AttributeError
Browse files- ui/gradio_ui.py +8 -5
ui/gradio_ui.py
CHANGED
|
@@ -537,11 +537,14 @@ def build_interface() -> gr.Blocks:
|
|
| 537 |
with gr.Accordion("π€ HuggingFace Client Logout", open=True): #, open=False):
|
| 538 |
# Logout controls
|
| 539 |
def do_logout():
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
|
|
|
|
|
|
|
|
|
| 545 |
|
| 546 |
def custom_do_logout():
|
| 547 |
return gr.update(value="Sign in to HuggingFace π€")
|
|
|
|
| 537 |
with gr.Accordion("π€ HuggingFace Client Logout", open=True): #, open=False):
|
| 538 |
# Logout controls
|
| 539 |
def do_logout():
|
| 540 |
+
try:
|
| 541 |
+
#ok = docextractor.client.logout()
|
| 542 |
+
ok = docconverter.client.logout()
|
| 543 |
+
# Reset token textbox on successful logout
|
| 544 |
+
msg = "β
Logged out of HuggingFace and cleared tokens. Remember to log out of HuggingFace completely." if ok else "β οΈ Logout failed."
|
| 545 |
+
return gr.update(value=""), gr.update(visible=True, value=msg), gr.update(value="Sign in to HuggingFace π€")
|
| 546 |
+
except AttributeError:
|
| 547 |
+
return gr.update(value=""), gr.update(visible=True, value=msg), gr.update(value="Sign in to HuggingFace π€")
|
| 548 |
|
| 549 |
def custom_do_logout():
|
| 550 |
return gr.update(value="Sign in to HuggingFace π€")
|