osanseviero commited on
Commit
050c83f
·
1 Parent(s): a727211

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -33,11 +33,13 @@ def duplicate(source_repo, dst_repo, token, repo_type):
33
  repo = Repository(local_dir=local_dir, clone_from=full_path)
34
 
35
  files = os.listdir(local_dir)
36
- for f in files:
37
- if not f.startswith("."):
38
  if repo_type == "model":
39
  repo_type = None
40
- upload_file(os.path.join(local_dir, f), f, dst_repo, token=token, repo_type=repo_type)
 
 
41
 
42
  # Clean up to be nice with the environment
43
  for filename in os.listdir(local_dir):
 
33
  repo = Repository(local_dir=local_dir, clone_from=full_path)
34
 
35
  files = os.listdir(local_dir)
36
+ for root, dirs, files in os.walk(local_dir):
37
+ if not root.startswith("."):
38
  if repo_type == "model":
39
  repo_type = None
40
+ for f in files:
41
+ path_in_repo = root.split("/")
42
+ upload_file(os.path.join(local_dir, path_in_repo, f), f, dst_repo, token=token, repo_type=repo_type, path_in_repo=path_in_repo)
43
 
44
  # Clean up to be nice with the environment
45
  for filename in os.listdir(local_dir):