mertunsall commited on
Commit
2a35e5e
·
1 Parent(s): 0edd404
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -55,16 +55,16 @@ def refresh_repo(repo_id: str):
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}"),
68
  {}
69
  )
70
 
@@ -79,7 +79,7 @@ def refresh_repo(repo_id: str):
79
  status_lines.append("• No sub-folders found at root.")
80
 
81
  dropdown_value = top_dirs[0] if top_dirs else None
82
- dropdown_update = gr.Dropdown.update(
83
  choices=top_dirs,
84
  value=dropdown_value,
85
  interactive=bool(top_dirs),
@@ -89,7 +89,7 @@ def refresh_repo(repo_id: str):
89
 
90
  folder_summary = _summarize_directory(repo_id, dropdown_value) if dropdown_value else {}
91
 
92
- return dropdown_update, gr.Markdown.update(value="\n".join(status_lines)), folder_summary
93
 
94
 
95
  def update_directory(repo_id: str, directory: str):
 
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.update(choices=[], value=None, interactive=False),
59
+ gr.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.update(choices=[], value=None, interactive=False),
67
+ gr.update(value=f"❌ Unexpected error loading `{repo_id}`: {error}"),
68
  {}
69
  )
70
 
 
79
  status_lines.append("• No sub-folders found at root.")
80
 
81
  dropdown_value = top_dirs[0] if top_dirs else None
82
+ dropdown_update = gr.update(
83
  choices=top_dirs,
84
  value=dropdown_value,
85
  interactive=bool(top_dirs),
 
89
 
90
  folder_summary = _summarize_directory(repo_id, dropdown_value) if dropdown_value else {}
91
 
92
+ return dropdown_update, gr.update(value="\n".join(status_lines)), folder_summary
93
 
94
 
95
  def update_directory(repo_id: str, directory: str):