File size: 566 Bytes
09204af
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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