Symbiomatrix commited on
Commit
15e3acd
·
verified ·
1 Parent(s): 9eed43a

Skip copied models.

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -115,6 +115,13 @@ def process_url(url, profile, user_repo_id, oauth_token, folder, api_key=None):
115
  try:
116
  download_url = data['downloadUrl']
117
  filename = dl_path.split('/')[-1]
 
 
 
 
 
 
 
118
  gr.Info(f"Downloading {filename} ({current_file}/{total_files})")
119
  download_file(download_url, dl_path, folder, api_key)
120
  # Upload the model and card
 
115
  try:
116
  download_url = data['downloadUrl']
117
  filename = dl_path.split('/')[-1]
118
+ if file_exists(
119
+ repo_id = user_repo_id,
120
+ filename = dl_path,
121
+ token = oauth_token
122
+ ):
123
+ gr.Info(f"Skipping {filename}, file exists {dl_path}")
124
+ continue
125
  gr.Info(f"Downloading {filename} ({current_file}/{total_files})")
126
  download_file(download_url, dl_path, folder, api_key)
127
  # Upload the model and card