danielle2003 commited on
Commit
6b19977
·
1 Parent(s): 0ab3c67

adding ml pipelines

Browse files
.github/workflows/train-deploy.yaml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Train and Deploy Model
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ -main
6
+ jobs:
7
+ train-evaluate-deploy:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: checkout repository
11
+ uses: actions/checkout@v3
12
+ - name: set up python
13
+ uses: actions/setup-python@v3
14
+ with:
15
+ python-version: 3.10
16
+ - name: install dependencies
17
+ runs:
18
+ pip install -r requirements.txt
19
+ - name: train the model
20
+ run: python train.py
21
+ - name: check-model accuracy
22
+ id: check-accuracy
23
+ run: |
24
+ ACCURACCY = $(python -c "import json; print(json.load(open('metrics.json'))['accuracy'])")
25
+ echo "Model Accuracy :$ACCURACY"
26
+ if (( $(echo $Accuracy: < 90" | bc -l))); then
27
+ echo "model accuracy is too low.skipping deployment"
28
+ exit 1
29
+ fi
30
+ - name: Deploy to hugging face
31
+ env:
32
+ HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
33
+ run: |
34
+ hugging-cli login --token $HF_TOKEN
35
+ git clone https://huggingface.co/spaces/danielle2003/diabeties-ml
36
+ cd diabeties-ml
37
+ cp ../diabetes-model.jolib
38
+ git add .
39
+ git commit -m "Updated model"
40
+ git push
41
+
42
+
43
+
44
+
45
+
requirements.txt CHANGED
@@ -1,4 +1,6 @@
1
  streamlit
2
  scikit-learn
3
  pandas
 
 
4
  joblib
 
1
  streamlit
2
  scikit-learn
3
  pandas
4
+ numpy
5
+ huggingface_hub
6
  joblib