fix: restore repo README, add HF Space config in files/README_HF.md #1
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
| name: CI/CD Crime Predictor | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| paths: [ 'models/crime_predictor/**' ] | |
| pull_request: | |
| paths: [ 'models/crime_predictor/**' ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| cd models/crime_predictor | |
| pip install -r requirements.txt pytest | |
| - name: Run tests | |
| run: | | |
| cd models/crime_predictor | |
| pytest tests/ -v | |
| - name: Build Docker | |
| run: | | |
| cd models/crime_predictor | |
| docker build -t crime-predictor:test . | |
| deploy-model: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Train & Deploy Model | |
| env: | |
| MLFLOW_TRACKING_URI: ${{ secrets.MLFLOW_URI }} | |
| run: | | |
| cd models/crime_predictor | |
| pip install -r requirements.txt mlflow | |
| mlflow server --backend-store-uri ./mlruns --default-artifact-root ./mlruns --host 0.0.0.0 --port 5000 & | |
| sleep 10 | |
| python train.py --data-url "https://static.data.gouv.fr/.../delinquance.csv" | |
| - name: Push Docker Image | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build & Push | |
| run: | | |
| cd models/crime_predictor | |
| docker build -t ghcr.io/${{ github.repository }}/crime-predictor:latest . | |
| docker push ghcr.io/${{ github.repository }}/crime-predictor:latest |