Commit
·
f021afe
1
Parent(s):
b411088
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,15 +37,16 @@ def duplicate(source_repo, dst_repo, token, repo_type):
|
|
| 37 |
if repo_type == "model":
|
| 38 |
repo_type = None
|
| 39 |
for f in files:
|
| 40 |
-
if not f.startswith(".")
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
| 49 |
|
| 50 |
|
| 51 |
# Clean up to be nice with the environment
|
|
|
|
| 37 |
if repo_type == "model":
|
| 38 |
repo_type = None
|
| 39 |
for f in files:
|
| 40 |
+
if not f.startswith("."):
|
| 41 |
+
if not ".git" in dirs:
|
| 42 |
+
directories_list = root.split("/")
|
| 43 |
+
path_in_repo = "/".join(directories_list[3:]) # remove hub/namespace/reponame
|
| 44 |
+
print(local_dir, path_in_repo, f)
|
| 45 |
+
if path_in_repo:
|
| 46 |
+
print("Download with path", path_in_repo)
|
| 47 |
+
upload_file(path_or_fileobj=os.path.join(local_dir, path_in_repo, f),repo_id=dst_repo, token=token, repo_type=repo_type, path_in_repo=path_in_repo)
|
| 48 |
+
else:
|
| 49 |
+
upload_file(path_or_fileobj=os.path.join(local_dir, path_in_repo, f), repo_id=dst_repo, token=token, repo_type=repo_type)
|
| 50 |
|
| 51 |
|
| 52 |
# Clean up to be nice with the environment
|