broadfield-dev commited on
Commit
8959513
·
verified ·
1 Parent(s): c66335f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -88,23 +88,20 @@ def delete_repo(token, repo_id, repo_type):
88
  api = get_hf_api(token)
89
  api.delete_repo(repo_id=repo_id, repo_type=repo_type)
90
  gr.Info(f"Successfully deleted '{repo_id}'.")
91
- return gr.update(), gr.update(visible=False), gr.update(visible=False)
92
  except HfHubHTTPError as e:
93
  gr.Error(f"Failed to delete repository: {e}")
94
  return repo_id, gr.update(visible=True), gr.update(visible=False)
95
 
96
  def archive_repo(token, repo_id, archive_repo):
97
- print(str(repo_id))
98
-
99
  """Deletes the selected repository."""
100
  if not token:
101
  gr.Error("A write-enabled Hugging Face token is required to delete a repository.")
102
  return repo_id, gr.update(visible=True), gr.update(visible=False)
103
  try:
104
  api = get_hf_api(token)
105
- print(repo_id)
106
  archive_space=f'{archive_repo}/{repo_id.split("/")[1]}'
107
- api.move_repo(repo_id=repo_id, archive_space=archive_space)
108
  gr.Info(f"Successfully moved to '{archive_space}'.")
109
  return gr.update(), gr.update(visible=False), gr.update(visible=False)
110
  except HfHubHTTPError as e:
 
88
  api = get_hf_api(token)
89
  api.delete_repo(repo_id=repo_id, repo_type=repo_type)
90
  gr.Info(f"Successfully deleted '{repo_id}'.")
91
+ return None, gr.update(visible=False), gr.update(visible=False)
92
  except HfHubHTTPError as e:
93
  gr.Error(f"Failed to delete repository: {e}")
94
  return repo_id, gr.update(visible=True), gr.update(visible=False)
95
 
96
  def archive_repo(token, repo_id, archive_repo):
 
 
97
  """Deletes the selected repository."""
98
  if not token:
99
  gr.Error("A write-enabled Hugging Face token is required to delete a repository.")
100
  return repo_id, gr.update(visible=True), gr.update(visible=False)
101
  try:
102
  api = get_hf_api(token)
 
103
  archive_space=f'{archive_repo}/{repo_id.split("/")[1]}'
104
+ api.move_repo(repo_id, archive_space)
105
  gr.Info(f"Successfully moved to '{archive_space}'.")
106
  return gr.update(), gr.update(visible=False), gr.update(visible=False)
107
  except HfHubHTTPError as e: