Upload folder using huggingface_hub
Browse files- README_SPACE.md +28 -0
- src/deploy_to_hf.py +40 -0
README_SPACE.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Engine Predictive Maintenance
|
| 3 |
+
emoji: 🔧
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_file: src/app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Engine Predictive Maintenance System
|
| 12 |
+
|
| 13 |
+
Predictive maintenance application for engine failure classification using sensor data.
|
| 14 |
+
|
| 15 |
+
## Features
|
| 16 |
+
|
| 17 |
+
- Real-time engine condition prediction
|
| 18 |
+
- Interactive sensor visualizations
|
| 19 |
+
- Model inference from trained Random Forest classifier
|
| 20 |
+
- Modern Streamlit interface
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
Enter sensor values (RPM, pressures, temperatures) to get real-time predictions about engine health.
|
| 25 |
+
|
| 26 |
+
## Model
|
| 27 |
+
|
| 28 |
+
Trained Random Forest model with hyperparameter tuning, deployed from Hugging Face Model Hub.
|
src/deploy_to_hf.py
CHANGED
|
@@ -41,6 +41,45 @@ def main() -> None:
|
|
| 41 |
exist_ok=True,
|
| 42 |
)
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
# Upload project files needed for deployment.
|
| 45 |
# We ignore large local artifacts like raw data, mlruns, and models,
|
| 46 |
# similar to how the reference notebook uploads only the deployment folder.
|
|
@@ -56,6 +95,7 @@ def main() -> None:
|
|
| 56 |
".git/*",
|
| 57 |
"__pycache__/*",
|
| 58 |
".github/*",
|
|
|
|
| 59 |
],
|
| 60 |
)
|
| 61 |
|
|
|
|
| 41 |
exist_ok=True,
|
| 42 |
)
|
| 43 |
|
| 44 |
+
# Create Space README with proper configuration
|
| 45 |
+
space_readme = """---
|
| 46 |
+
title: Engine Predictive Maintenance
|
| 47 |
+
emoji: 🔧
|
| 48 |
+
colorFrom: blue
|
| 49 |
+
colorTo: red
|
| 50 |
+
sdk: docker
|
| 51 |
+
app_file: src/app.py
|
| 52 |
+
pinned: false
|
| 53 |
+
---
|
| 54 |
+
|
| 55 |
+
# Engine Predictive Maintenance System
|
| 56 |
+
|
| 57 |
+
Predictive maintenance application for engine failure classification using sensor data.
|
| 58 |
+
|
| 59 |
+
## Features
|
| 60 |
+
|
| 61 |
+
- Real-time engine condition prediction
|
| 62 |
+
- Interactive sensor visualizations
|
| 63 |
+
- Model inference from trained Random Forest classifier
|
| 64 |
+
- Modern Streamlit interface
|
| 65 |
+
|
| 66 |
+
## Usage
|
| 67 |
+
|
| 68 |
+
Enter sensor values (RPM, pressures, temperatures) to get real-time predictions about engine health.
|
| 69 |
+
|
| 70 |
+
## Model
|
| 71 |
+
|
| 72 |
+
Trained Random Forest model with hyperparameter tuning, deployed from Hugging Face Model Hub.
|
| 73 |
+
"""
|
| 74 |
+
|
| 75 |
+
# Upload Space README first
|
| 76 |
+
api.upload_file(
|
| 77 |
+
path_or_fileobj=space_readme.encode(),
|
| 78 |
+
path_in_repo="README.md",
|
| 79 |
+
repo_id=space_repo,
|
| 80 |
+
repo_type="space",
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
# Upload project files needed for deployment.
|
| 84 |
# We ignore large local artifacts like raw data, mlruns, and models,
|
| 85 |
# similar to how the reference notebook uploads only the deployment folder.
|
|
|
|
| 95 |
".git/*",
|
| 96 |
"__pycache__/*",
|
| 97 |
".github/*",
|
| 98 |
+
"README.md", # Don't upload project README, use Space-specific one
|
| 99 |
],
|
| 100 |
)
|
| 101 |
|