#!/bin/bash # Uploads new images to Hugging Face repo every 5 minutes if there are changes. # Usage: Go to terminal, go to microscope-data directory, and run `./upload.sh` INTERVAL=310 # 5 min + buffer while true; do # Check if there's anything new to commit if [[ -n $(git status --porcelain) ]]; then echo "[$(date)] Adding and committing..." git add . git commit -m "Add images batch $(date +%Y%m%d_%H%M%S)" git push echo "[$(date)] Pushed successfully." else echo "[$(date)] Nothing new to commit." fi sleep $INTERVAL done