npv2k1 commited on
Commit
8f08bab
·
1 Parent(s): 98fb351
.github/workflows/deploy-to-huggingface.yml ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to Hugging Face
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ with:
15
+ fetch-depth: 0
16
+ lfs: true
17
+
18
+ - name: Setup Python
19
+ uses: actions/setup-python@v4
20
+ with:
21
+ python-version: '3.10'
22
+ cache: 'pip'
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -r requirements.txt
28
+ pip install -e .
29
+
30
+ - name: Configure Hugging Face
31
+ env:
32
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
33
+ HF_USERNAME: ${{ secrets.HF_USERNAME }}
34
+ run: |
35
+ # Install Hugging Face CLI
36
+ pip install huggingface-hub
37
+ # Login to Hugging Face
38
+ huggingface-cli login --token $HF_TOKEN --add-to-git-credential
39
+
40
+ - name: Push to Hugging Face
41
+ env:
42
+ HF_USERNAME: ${{ secrets.HF_USERNAME }}
43
+ SPACE_NAME: ${{ secrets.SPACE_NAME }}
44
+ run: |
45
+ git config --global user.email "actions@github.com"
46
+ git config --global user.name "github-actions"
47
+
48
+ # Create repository URL
49
+ REPO_URL="https://huggingface.co/spaces/$HF_USERNAME/$SPACE_NAME"
50
+
51
+ # Add Hugging Face as a remote and push
52
+ git remote add space $REPO_URL || git remote set-url space $REPO_URL
53
+ git push -f space main