improvisation-lab / .github /workflows /deploy_to_hf.yml
atsushieee's picture
Upload folder using huggingface_hub
4a99ffd verified
name: Deploy to Hugging Face Spaces
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.7.1 python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Export requirements.txt
run: poetry export -f requirements.txt --output requirements.txt --without-hashes
- name: Create packages.txt
run: |
echo "portaudio19-dev" > packages.txt
- name: Prepend YAML header to README
run: |
cat hf_space_metadata.yml README.md > new_readme.md
mv new_readme.md README.md
- name: Install Hugging Face CLI
run: |
python -m pip install --upgrade pip
pip install huggingface_hub
- name: Configure Hugging Face CLI
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
huggingface-cli login --token $HF_TOKEN
- name: Deploy to Spaces
env:
HF_USERNAME: ${{ secrets.HF_USERNAME }}
SPACE_NAME: ${{ secrets.SPACE_NAME }}
run: |
huggingface-cli upload atsushieee/improvisation-lab . --repo-type=space