semmyk commited on
Commit
33d9ec0
Β·
1 Parent(s): 5e6e3a7

rebaseline07_23Sept25_05 - HF logout. Handle exception docconverter AttributeError

Browse files
Files changed (1) hide show
  1. 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
- #ok = docextractor.client.logout()
541
- ok = docconverter.client.logout()
542
- # Reset token textbox on successful logout
543
- msg = "βœ… Logged out of HuggingFace and cleared tokens. Remember to log out of HuggingFace completely." if ok else "⚠️ Logout failed."
544
- return gr.update(value=""), gr.update(visible=True, value=msg), gr.update(value="Sign in to HuggingFace πŸ€—")
 
 
 
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 πŸ€—")