| name: Deploy to Hugging Face Space | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.10' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install huggingface_hub | |
| - name: Deploy to Space | |
| env: | |
| HUGGINGFACE_TOKEN: ${{ secrets.HUGGINGFACE_TOKEN }} | |
| run: | | |
| python -c ' | |
| from huggingface_hub import HfApi, create_repo | |
| api = HfApi() | |
| create_repo("chrizefan/digichat", token="${{ secrets.HUGGINGFACE_TOKEN }}", repo_type="space", space_sdk="gradio", exist_ok=True) | |
| api.upload_folder( | |
| folder_path=".", | |
| repo_id="chrizefan/digichat", | |
| repo_type="space", | |
| token="${{ secrets.HUGGINGFACE_TOKEN }}", | |
| ignore_patterns=["__pycache__", "*.pyc", ".env", ".git", ".gitignore", ".conda"] | |
| ) | |
| ' | |