File size: 1,954 Bytes
c3d82b0
 
 
 
 
9e1c398
c3d82b0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Sync to Hugging Face Hub for Gradio App MNIST Classifier  # this is not working due to lfs issue

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

      # Ensure LFS objects are checked out
      - 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