Commit
·
b411088
1
Parent(s):
15d0c29
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,6 @@ def duplicate(source_repo, dst_repo, token, repo_type):
|
|
| 32 |
else:
|
| 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":
|
|
@@ -41,12 +40,12 @@ def duplicate(source_repo, dst_repo, token, repo_type):
|
|
| 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(
|
| 45 |
if path_in_repo:
|
| 46 |
print("Download with path", path_in_repo)
|
| 47 |
-
upload_file(os.path.join(
|
| 48 |
else:
|
| 49 |
-
upload_file(os.path.join(
|
| 50 |
|
| 51 |
|
| 52 |
# Clean up to be nice with the environment
|
|
|
|
| 32 |
else:
|
| 33 |
repo = Repository(local_dir=local_dir, clone_from=full_path)
|
| 34 |
|
|
|
|
| 35 |
for root, dirs, files in os.walk(local_dir):
|
| 36 |
if not root.startswith("."):
|
| 37 |
if repo_type == "model":
|
|
|
|
| 40 |
if not f.startswith(".") and not ".git" in dirs:
|
| 41 |
directories_list = root.split("/")
|
| 42 |
path_in_repo = "/".join(directories_list[3:]) # remove hub/namespace/reponame
|
| 43 |
+
print(os.path.join(local_dir, path_in_repo, f), path_in_repo)
|
| 44 |
if path_in_repo:
|
| 45 |
print("Download with path", path_in_repo)
|
| 46 |
+
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)
|
| 47 |
else:
|
| 48 |
+
upload_file(os.path.join(local_dir, path_in_repo, f), f, dst_repo, token=token, repo_type=repo_type)
|
| 49 |
|
| 50 |
|
| 51 |
# Clean up to be nice with the environment
|