|
name: Sync to Hugging Face Hub for Gradio App MNIST Classifier |
|
|
|
on: |
|
push: |
|
branches: |
|
- master |
|
|
|
jobs: |
|
sync-to-hub: |
|
runs-on: ubuntu-latest |
|
steps: |
|
- uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
lfs: true |
|
|
|
- name: Install Git LFS |
|
run: | |
|
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash |
|
sudo apt-get install git-lfs |
|
git lfs install |
|
|
|
- name: Configure Git identity |
|
run: | |
|
git config --global user.name "soutrik" |
|
git config --global user.email "soutrik.chowdhury@ab-inbev.com" |
|
|
|
- name: Add remote |
|
run: | |
|
git remote add space https://$USER:$HF_TOKEN@huggingface.co/spaces/$USER/$SPACE |
|
env: |
|
HF_TOKEN: ${{ secrets.HF_TOKEN }} |
|
USER: soutrik |
|
SPACE: gradio_demo_MNIST_Classifier |
|
|
|
|
|
- name: Ensure LFS objects are present |
|
run: git lfs checkout |
|
|
|
- name: Add README.md |
|
run: | |
|
cat <<EOF > README.md |
|
--- |
|
title: My Gradio App MNIST Classifier |
|
emoji: π |
|
colorFrom: blue |
|
colorTo: green |
|
sdk: gradio |
|
sdk_version: "5.7.1" |
|
app_file: app.py |
|
pinned: false |
|
--- |
|
EOF |
|
git add README.md |
|
git commit -m "Add README.md" || echo "Skip commit if no changes" |
|
|
|
- name: Push to hub |
|
run: | |
|
git push --force https://$USER:$HF_TOKEN@huggingface.co/spaces/$USER/$SPACE main |
|
env: |
|
HF_TOKEN: ${{ secrets.HF_TOKEN }} |
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} |
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
|
AWS_REGION: ${{ secrets.AWS_REGION }} |
|
USER: soutrik |
|
SPACE: gradio_demo_MNIST_Classifier |
|
|