Skip to content

Create deploy.yml

Create deploy.yml #3

name: Huggingface Deployment
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.sha }} # Pin to specific commit
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Authenticate with Huggingface
run: huggingface-cli login --token ${{ secrets.HF_TOKEN }}
- name: Deploy to Huggingface
run: |
huggingface-cli repo create my-streamlit-app --type=space --private
huggingface-cli repo upload --repo-id Canstralian/Transformers-Fine-Tuner app.py requirements.txt
huggingface-cli space hardware --repo-id Canstralian/Transformers-Fine-Tuner-app --hardware cpu-basic
continue-on-error: true # Allow workflow to continue even if deployment fails