Commit
·
32478ba
1
Parent(s):
1dbc6c6
Initial commit for Hugging Face
Browse files
scripts/upload_to_huggingface.py
CHANGED
|
@@ -261,9 +261,17 @@ def upload_to_huggingface(repo_path: Path, repo_name: str, private: bool = False
|
|
| 261 |
subprocess.run(["git", "add", "."], check=True)
|
| 262 |
print(" Added files to git")
|
| 263 |
|
| 264 |
-
#
|
| 265 |
-
subprocess.run(["git", "
|
| 266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
|
| 268 |
# Add Hugging Face remote
|
| 269 |
remote_url = f"https://huggingface.co/{repo_id}"
|
|
|
|
| 261 |
subprocess.run(["git", "add", "."], check=True)
|
| 262 |
print(" Added files to git")
|
| 263 |
|
| 264 |
+
# Check if there are changes to commit
|
| 265 |
+
result = subprocess.run(["git", "status", "--porcelain"],
|
| 266 |
+
capture_output=True, text=True, check=True)
|
| 267 |
+
|
| 268 |
+
if result.stdout.strip():
|
| 269 |
+
# There are changes to commit
|
| 270 |
+
subprocess.run(["git", "commit", "-m", "Initial commit for Hugging Face"], check=True)
|
| 271 |
+
print(" Committed changes")
|
| 272 |
+
else:
|
| 273 |
+
# No changes to commit
|
| 274 |
+
print(" No changes to commit (working tree clean)")
|
| 275 |
|
| 276 |
# Add Hugging Face remote
|
| 277 |
remote_url = f"https://huggingface.co/{repo_id}"
|