Fix requirements.txt merge conflict and update workflow for CI stability #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# GitHub Actions workflow for training and uploading models to Hugging Face Hub | |
# Place this file in .github/workflows/train-and-upload.yml | |
name: Train and Upload Model to Hugging Face Hub | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
train-and-upload: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
pip install huggingface_hub tensorflowjs | |
shell: bash | |
- name: Train model (replace with your script) | |
run: | | |
python main.py # or your training script | |
- name: Convert Keras model to TensorFlow.js | |
run: | | |
tensorflowjs_converter --input_format=keras image_classifier.keras tfjs_model/ | |
- name: Upload models to Hugging Face Hub | |
env: | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
run: | | |
python scripts/upload_to_hub.py |