engresearch's picture
Upload folder using huggingface_hub
7f88bdf verified
#!/usr/bin/env python3
"""Push worker changes to HF Spaces."""
import subprocess
import sys
from pathlib import Path
def main():
worker_dir = Path(__file__).resolve().parents[1] / "apps" / "worker"
# Add changes
subprocess.run(["git", "add", "src/worker/embeddings.py", "src/worker/main.py"],
cwd=worker_dir, check=False)
# Commit
result = subprocess.run(
["git", "commit", "-m", "Fix numpy float32 in embeddings and remove db log from exception handler"],
cwd=worker_dir, capture_output=True, text=True
)
print("Commit:", result.stdout)
print("Commit stderr:", result.stderr)
# Push
result = subprocess.run(
["git", "push", "origin", "main", "--force"],
cwd=worker_dir, capture_output=True, text=True
)
print("Push:", result.stdout)
print("Push stderr:", result.stderr)
return result.returncode
if __name__ == "__main__":
sys.exit(main())