mertunsall commited on
Commit
0edd404
·
1 Parent(s): b84230c
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  from functools import lru_cache
 
2
 
3
  import gradio as gr
4
  from huggingface_hub import HfApi
@@ -51,12 +52,16 @@ def refresh_repo(repo_id: str):
51
  try:
52
  top_dirs, top_files = _extract_top_level(repo_id)
53
  except HfHubHTTPError as error:
 
 
54
  return (
55
  gr.Dropdown.update(choices=[], value=None, interactive=False),
56
  gr.Markdown.update(value=f"❌ Unable to load repo `{repo_id}`: {error}"),
57
  {}
58
  )
59
  except Exception as error: # pragma: no cover - network and auth edge cases
 
 
60
  return (
61
  gr.Dropdown.update(choices=[], value=None, interactive=False),
62
  gr.Markdown.update(value=f"❌ Unexpected error loading `{repo_id}`: {error}"),
@@ -88,7 +93,12 @@ def refresh_repo(repo_id: str):
88
 
89
 
90
  def update_directory(repo_id: str, directory: str):
91
- return _summarize_directory(repo_id, directory)
 
 
 
 
 
92
 
93
 
94
  with gr.Blocks(title="HF Dataset Explorer") as demo:
 
1
  from functools import lru_cache
2
+ import traceback
3
 
4
  import gradio as gr
5
  from huggingface_hub import HfApi
 
52
  try:
53
  top_dirs, top_files = _extract_top_level(repo_id)
54
  except HfHubHTTPError as error:
55
+ print(f"[refresh_repo] Hub HTTP error for {repo_id}: {error}", flush=True)
56
+ print(traceback.format_exc(), flush=True)
57
  return (
58
  gr.Dropdown.update(choices=[], value=None, interactive=False),
59
  gr.Markdown.update(value=f"❌ Unable to load repo `{repo_id}`: {error}"),
60
  {}
61
  )
62
  except Exception as error: # pragma: no cover - network and auth edge cases
63
+ print(f"[refresh_repo] Unexpected error for {repo_id}: {error}", flush=True)
64
+ print(traceback.format_exc(), flush=True)
65
  return (
66
  gr.Dropdown.update(choices=[], value=None, interactive=False),
67
  gr.Markdown.update(value=f"❌ Unexpected error loading `{repo_id}`: {error}"),
 
93
 
94
 
95
  def update_directory(repo_id: str, directory: str):
96
+ try:
97
+ return _summarize_directory(repo_id, directory)
98
+ except Exception as error:
99
+ print(f"[update_directory] Error for {repo_id}/{directory}: {error}", flush=True)
100
+ print(traceback.format_exc(), flush=True)
101
+ return {}
102
 
103
 
104
  with gr.Blocks(title="HF Dataset Explorer") as demo: