Spaces:
Running
Running
lucabadiali
commited on
Commit
·
8eabda0
1
Parent(s):
295d729
AA
Browse files
.github/workflows/huggingface-space-deploy.yml
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Deploy to Hugging Face Space
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches:
|
| 6 |
+
- main # or your default branch
|
| 7 |
+
# optional: allow manual trigger from Actions tab
|
| 8 |
+
workflow_dispatch:
|
| 9 |
+
|
| 10 |
+
jobs:
|
| 11 |
+
deploy:
|
| 12 |
+
runs-on: ubuntu-latest
|
| 13 |
+
|
| 14 |
+
steps:
|
| 15 |
+
- name: Checkout code
|
| 16 |
+
uses: actions/checkout@v4
|
| 17 |
+
with:
|
| 18 |
+
fetch-depth: 0
|
| 19 |
+
lfs: true
|
| 20 |
+
|
| 21 |
+
- name: Push to Hugging Face Space
|
| 22 |
+
env:
|
| 23 |
+
HF_TOKEN: ${{ secrets.HF_HUB_TOKEN }}
|
| 24 |
+
run: |
|
| 25 |
+
# Add the HF Space as a remote
|
| 26 |
+
git remote add space https://huggingface.co/spaces/lucabadiali/ML_OPS_Project
|
| 27 |
+
|
| 28 |
+
# Push the current commit on main to the Space's main
|
| 29 |
+
git push --force https://lucabadiali:$HF_TOKEN@huggingface.co/spaces/lucabadiali/ML_OPS_Project HEAD:main
|
src/train_model.py
CHANGED
|
@@ -12,7 +12,6 @@ from datasets import load_dataset,load_from_disk
|
|
| 12 |
from pathlib import Path
|
| 13 |
|
| 14 |
|
| 15 |
-
|
| 16 |
# --- Device detection ---
|
| 17 |
if torch.cuda.is_available():
|
| 18 |
device = "cuda"
|
|
|
|
| 12 |
from pathlib import Path
|
| 13 |
|
| 14 |
|
|
|
|
| 15 |
# --- Device detection ---
|
| 16 |
if torch.cuda.is_available():
|
| 17 |
device = "cuda"
|