Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
@@ -111,6 +111,9 @@ def save_to_hub(image, current_datetime, metadata, output_path):
|
|
111 |
except RepositoryNotFoundError:
|
112 |
repo = Repository(f"{username}/{repo_name}", clone_from=f"{username}/{repo_name}", use_auth_token=token, repo_type="dataset")
|
113 |
|
|
|
|
|
|
|
114 |
# Generate a random 10-digit number
|
115 |
random_number = random.randint(1000000000, 9999999999)
|
116 |
|
@@ -128,6 +131,7 @@ def save_to_hub(image, current_datetime, metadata, output_path):
|
|
128 |
subprocess.run(["git", "config", "user.name", "idle stoev"], check=True, cwd=repo.local_dir)
|
129 |
subprocess.run(["git", "config", "user.email", "[email protected]"], check=True, cwd=repo.local_dir)
|
130 |
|
|
|
131 |
# Commit and push changes
|
132 |
repo.git_add(pattern=".")
|
133 |
repo.git_commit(f"Add image at {current_datetime}")
|
|
|
111 |
except RepositoryNotFoundError:
|
112 |
repo = Repository(f"{username}/{repo_name}", clone_from=f"{username}/{repo_name}", use_auth_token=token, repo_type="dataset")
|
113 |
|
114 |
+
# Pull the latest changes from the remote repository
|
115 |
+
repo.git_pull()
|
116 |
+
|
117 |
# Generate a random 10-digit number
|
118 |
random_number = random.randint(1000000000, 9999999999)
|
119 |
|
|
|
131 |
subprocess.run(["git", "config", "user.name", "idle stoev"], check=True, cwd=repo.local_dir)
|
132 |
subprocess.run(["git", "config", "user.email", "[email protected]"], check=True, cwd=repo.local_dir)
|
133 |
|
134 |
+
|
135 |
# Commit and push changes
|
136 |
repo.git_add(pattern=".")
|
137 |
repo.git_commit(f"Add image at {current_datetime}")
|