hwang2006's picture
Upload folder using huggingface_hub
11d7c72 verified
name: Deploy to Hot Dog Classifier Demo Space
on:
push:
branches: [ main ] # Change this to the branch you want to trigger the deployment from
workflow_dispatch: # Allows manual triggering
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install huggingface_hub
run: pip install huggingface_hub
- name: Configure Hugging Face Token
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
mkdir -p ~/.huggingface
echo "$HF_TOKEN" > ~/.huggingface/token
- name: Deploy to Hot Dog Classifier Demo Space
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
SPACE_NAME: "hwang2006/hot-dog-classifier-demo"
run: |
python -c "
from huggingface_hub import HfApi
api = HfApi()
api.upload_folder(
folder_path='.',
repo_id='$SPACE_NAME',
repo_type='space',
)
"