Spaces:
Sleeping
Sleeping
Merging PR changes from main
Browse files- .github/workflows/train-deploy.yaml +35 -23
- app.py +2 -0
.github/workflows/train-deploy.yaml
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
name: Train and Deploy Model
|
|
|
2 |
on:
|
3 |
pull_request:
|
4 |
branches:
|
5 |
-
- master
|
6 |
-
workflow_dispatch:
|
7 |
|
8 |
jobs:
|
9 |
train-evaluate-deploy:
|
@@ -13,15 +14,33 @@ jobs:
|
|
13 |
steps:
|
14 |
- name: Checkout repository
|
15 |
uses: actions/checkout@v3
|
16 |
-
|
17 |
-
- name: Set up Python
|
18 |
-
uses: actions/setup-python@v3
|
19 |
with:
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
- name: Install dependencies
|
23 |
run: pip install -r requirements.txt
|
24 |
-
|
25 |
- name: Upgrade Hugging Face Hub
|
26 |
run: pip install --upgrade huggingface_hub
|
27 |
|
@@ -29,23 +48,16 @@ jobs:
|
|
29 |
run: |
|
30 |
huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
|
31 |
|
32 |
-
- name: Download Model Repository
|
33 |
-
run: huggingface-cli download danielle2003/diabeties-ml --repo-type space --local-dir diabetes-ml
|
34 |
-
- name: Push `main` changes to `master`
|
35 |
-
run: |
|
36 |
-
git checkout "master" # Switch to master branch
|
37 |
-
git pull origin master # Ensure latest master
|
38 |
-
git merge --no-ff origin/main -m "Merging latest changes from main"
|
39 |
-
git push origin master # Push changes to master
|
40 |
- name: Deploy to Hugging Face
|
41 |
env:
|
42 |
-
|
43 |
run: |
|
44 |
huggingface-cli login --token $HF_TOKEN
|
45 |
-
|
46 |
-
git
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
|
|
|
1 |
name: Train and Deploy Model
|
2 |
+
|
3 |
on:
|
4 |
pull_request:
|
5 |
branches:
|
6 |
+
- master # Runs when a PR is made to master
|
7 |
+
workflow_dispatch: # Allows manual triggering
|
8 |
|
9 |
jobs:
|
10 |
train-evaluate-deploy:
|
|
|
14 |
steps:
|
15 |
- name: Checkout repository
|
16 |
uses: actions/checkout@v3
|
|
|
|
|
|
|
17 |
with:
|
18 |
+
fetch-depth: 0 # Fetch all branches
|
19 |
+
|
20 |
+
- name: Set up Git
|
21 |
+
run: |
|
22 |
+
git config --global user.email "[email protected]"
|
23 |
+
git config --global user.name "dani-ange"
|
24 |
+
|
25 |
+
- name: Ensure master branch is up-to-date
|
26 |
+
run: |
|
27 |
+
git checkout master # Ensure we're on master
|
28 |
+
git pull origin master # Get latest changes
|
29 |
+
|
30 |
+
- name: Merge PR changes into master
|
31 |
+
run: |
|
32 |
+
# Ensure the PR branch is properly merged
|
33 |
+
if git branch -r | grep "origin/${{ github.head_ref }}"; then
|
34 |
+
git merge --no-ff origin/${{ github.head_ref }} -m "Merging PR changes from ${{ github.head_ref }}"
|
35 |
+
git push origin master # Push merged changes
|
36 |
+
else
|
37 |
+
echo "Error: Branch ${{ github.head_ref }} does not exist in remote."
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
|
41 |
- name: Install dependencies
|
42 |
run: pip install -r requirements.txt
|
43 |
+
|
44 |
- name: Upgrade Hugging Face Hub
|
45 |
run: pip install --upgrade huggingface_hub
|
46 |
|
|
|
48 |
run: |
|
49 |
huggingface-cli login --token "${{ secrets.HUGGINGFACE_API_TOKEN }}" --add-to-git-credential
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
- name: Deploy to Hugging Face
|
52 |
env:
|
53 |
+
HF_TOKEN: ${{ secrets.HUGGINGFACE_API_TOKEN }}
|
54 |
run: |
|
55 |
huggingface-cli login --token $HF_TOKEN
|
56 |
+
|
57 |
+
if git diff --quiet; then
|
58 |
+
echo "No changes to commit."
|
59 |
+
else
|
60 |
+
git add .
|
61 |
+
git commit -m "Updated model after merging PR"
|
62 |
+
git push https://danielle2003:[email protected]/spaces/danielle2003/diabeties-ml master
|
63 |
+
fi
|
app.py
CHANGED
@@ -11,6 +11,8 @@ st.write("Enter patient data to predict diabetes")
|
|
11 |
|
12 |
# Input fields
|
13 |
st.header("welcome to the appa")
|
|
|
|
|
14 |
pregnancies = st.number_input("Pregnancies", min_value=0, max_value=20)
|
15 |
glucose = st.number_input("Glucose Level", min_value=0, max_value=200)
|
16 |
blood_pressure = st.number_input("Blood Pressure", min_value=0, max_value=200)
|
|
|
11 |
|
12 |
# Input fields
|
13 |
st.header("welcome to the appa")
|
14 |
+
=======
|
15 |
+
|
16 |
pregnancies = st.number_input("Pregnancies", min_value=0, max_value=20)
|
17 |
glucose = st.number_input("Glucose Level", min_value=0, max_value=200)
|
18 |
blood_pressure = st.number_input("Blood Pressure", min_value=0, max_value=200)
|