Myco / .github /workflows /sync_to_hf.yml
byte-vortex's picture
Upload folder using huggingface_hub
4713899 verified
Raw
History Blame Contribute Delete
1.08 kB
name: Sync to Hugging Face hub
on:
push:
branches: [main]
workflow_dispatch:
jobs:
sync-to-hub:
runs-on: ubuntu-latest
steps:
- name: Checkout repository code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Hugging Face Hub library
run: pip install huggingface_hub
- name: Upload project files to HF Space
env:
HF_TOKEN: ${{ secrets.HF_BUILD_SMALL_HACKATHON_TOKEN }}
run: |
python -c "
import os
from huggingface_hub import HfApi
# Initialize the API using your GitHub Actions secret
api = HfApi(token=os.environ['HF_TOKEN'])
# Upload everything in the repository folder directly to your Space
api.upload_folder(
folder_path='.',
repo_id='byte-vortex/Myco',
repo_type='space'
)
"