| |
| """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" |
| |
| |
| subprocess.run(["git", "add", "src/worker/embeddings.py", "src/worker/main.py"], |
| cwd=worker_dir, check=False) |
| |
| |
| 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) |
| |
| |
| 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()) |
|
|