Commit
·
15d0c29
1
Parent(s):
ba5089f
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,11 +38,12 @@ def duplicate(source_repo, dst_repo, token, repo_type):
|
|
| 38 |
if repo_type == "model":
|
| 39 |
repo_type = None
|
| 40 |
for f in files:
|
| 41 |
-
if not f.startswith("."):
|
| 42 |
directories_list = root.split("/")
|
| 43 |
-
path_in_repo = "/".join(directories_list[
|
| 44 |
print(os.path.join("hub", path_in_repo, f), path_in_repo)
|
| 45 |
if path_in_repo:
|
|
|
|
| 46 |
upload_file(os.path.join("hub", path_in_repo, f), f, dst_repo, token=token, repo_type=repo_type, path_in_repo=path_in_repo)
|
| 47 |
else:
|
| 48 |
upload_file(os.path.join("hub", path_in_repo, f), f, dst_repo, token=token, repo_type=repo_type)
|
|
|
|
| 38 |
if repo_type == "model":
|
| 39 |
repo_type = None
|
| 40 |
for f in files:
|
| 41 |
+
if not f.startswith(".") and not ".git" in dirs:
|
| 42 |
directories_list = root.split("/")
|
| 43 |
+
path_in_repo = "/".join(directories_list[3:]) # remove hub/namespace/reponame
|
| 44 |
print(os.path.join("hub", path_in_repo, f), path_in_repo)
|
| 45 |
if path_in_repo:
|
| 46 |
+
print("Download with path", path_in_repo)
|
| 47 |
upload_file(os.path.join("hub", path_in_repo, f), f, dst_repo, token=token, repo_type=repo_type, path_in_repo=path_in_repo)
|
| 48 |
else:
|
| 49 |
upload_file(os.path.join("hub", path_in_repo, f), f, dst_repo, token=token, repo_type=repo_type)
|