deropxyz commited on
Commit
3f5e617
·
1 Parent(s): 03bcd34

fix readme

Browse files
Files changed (1) hide show
  1. README.md +42 -57
README.md CHANGED
@@ -1,57 +1,42 @@
1
- # Hugging Face Spaces Deployment
2
-
3
- This folder contains everything required to deploy the Predictive Maintenance API to Hugging Face Spaces as a Docker Space.
4
-
5
- ## Contents
6
-
7
- - `api/`: FastAPI application (copied from `AC02-ML/api`)
8
- - `requirements.txt`: Python dependencies (now includes `huggingface_hub`)
9
- - `Dockerfile`: Container recipe used by Spaces
10
-
11
- ## One-Time Setup
12
-
13
- 1. Install the Hugging Face CLI and log in:
14
- ```
15
- pip install huggingface_hub
16
- huggingface-cli login
17
- ```
18
- 2. (Optional) Enable Git LFS if the model artifacts exceed 10 MB:
19
- ```
20
- git lfs install
21
- ```
22
-
23
- ## Deploy Steps
24
-
25
- 1. Initialize the Space repository (replace `<org>` and `<space>`):
26
- ```
27
- cd hf-space
28
- git init
29
- git remote add origin https://huggingface.co/spaces/<org>/<space>
30
- ```
31
- 2. Commit the deployment bundle:
32
- ```
33
- git add .
34
- git commit -m "Initial Hugging Face Space"
35
- git push origin main
36
- ```
37
- 3. In the Hugging Face UI:
38
- - Set **Space SDK** to `Docker`.
39
- - Pick hardware (`CPU Basic` is enough for CPU-only inference).
40
- - Restart the Space if you tweak environment variables (e.g., secrets).
41
-
42
- Once the build succeeds, the FastAPI docs are accessible at `https://<space>.hf.space/docs` and the REST endpoints follow the paths defined in `api/main.py`.
43
-
44
- ### Hosting model artifacts
45
-
46
- - Upload the serialized pipelines to the existing Hugging Face _model_ repo `deropxyz/AC02-ML`:
47
- ```
48
- hf upload --repo-id deropxyz/AC02-ML AC02-ML/model_pipeline_improved.joblib
49
- hf upload --repo-id deropxyz/AC02-ML AC02-ML/model_pipeline.joblib
50
- ```
51
- - `api/main.py` downloads the artifacts at startup using `HF_MODEL_REPO`, `HF_PRIMARY_MODEL`, and `HF_FALLBACK_MODEL` env vars (defaults target `deropxyz/AC02-ML`). If the model repo is private, add `HF_TOKEN` in the Space settings (Variables & secrets).
52
- - No large binaries are stored inside this repo; the runtime pulls them from the Hub cache.
53
-
54
- ## Keeping the Space Updated
55
-
56
- - Copy any new code from `AC02-ML` into this folder, commit, and push.
57
- - When retraining, upload the new model artifact to the Hub model repo and update the env vars if filenames change.
 
1
+ ---
2
+ title: AC02-ML
3
+ emoji: ⚙️
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: docker
7
+ sdk_version: "latest"
8
+ app_file: api/main.py
9
+ pinned: false
10
+ ---
11
+
12
+ # AC02-ML Predictive Maintenance API
13
+
14
+ This Space deploys a Predictive Maintenance API using FastAPI and Docker.
15
+
16
+ ## API Endpoints
17
+
18
+ - **POST `/predict`**: Get maintenance predictions for equipment
19
+ - **POST `/predict_batch`**: Process multiple equipment data points
20
+ - **GET `/docs`**: Interactive API documentation (FastAPI/Swagger)
21
+ - **GET `/health`**: Health check endpoint
22
+
23
+ ## Model Information
24
+
25
+ This API uses machine learning models trained for predictive maintenance:
26
+
27
+ - Primary model: Enhanced pipeline with feature engineering
28
+ - Fallback model: Basic model pipeline
29
+ - Models are automatically downloaded from the Hugging Face Hub at startup
30
+
31
+ ## Usage
32
+
33
+ Visit the `/docs` endpoint to interact with the API through the Swagger UI, or send POST requests to the prediction endpoints with equipment sensor data.
34
+
35
+ ## Technical Details
36
+
37
+ - **Framework**: FastAPI
38
+ - **Deployment**: Docker container
39
+ - **Models**: Hosted on Hugging Face Model Hub
40
+ - **Environment**: Python 3.9+
41
+
42
+ For more information about deployment and setup, please refer to the project documentation.