UdasriHasindu commited on
Commit
491f8d0
·
1 Parent(s): 6f5feff

setup HF support

Browse files
Files changed (4) hide show
  1. .gitignore +3 -0
  2. Dockerfile +3 -3
  3. README.md +41 -1
  4. app.py +1 -1
.gitignore CHANGED
@@ -173,6 +173,9 @@ cython_debug/
173
  # PyPI configuration file
174
  .pypirc
175
 
 
 
 
176
  # Cursor
177
  # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
178
  # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
 
173
  # PyPI configuration file
174
  .pypirc
175
 
176
+ # Runtime outputs
177
+ runs/
178
+
179
  # Cursor
180
  # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
181
  # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
Dockerfile CHANGED
@@ -25,10 +25,10 @@ COPY app.py /app/app.py
25
  COPY scripts /app/scripts
26
 
27
  # Create output directory
28
- RUN mkdir -p /app/runs/outputs
29
 
30
  # Expose port
31
- EXPOSE 8000
32
 
33
  # Run the application
34
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
25
  COPY scripts /app/scripts
26
 
27
  # Create output directory
28
+ RUN mkdir -p /app/runs/outputs && chmod +x /app/scripts/start.sh
29
 
30
  # Expose port
31
+ EXPOSE 7860
32
 
33
  # Run the application
34
+ CMD ["/app/scripts/start.sh"]
README.md CHANGED
@@ -20,7 +20,15 @@ Open Swagger UI:
20
  - `POST /analyze`
21
  - form-data:
22
  - `video`: video file (front-view gait)
23
- - `patient_gender`: `male` or `female`
 
 
 
 
 
 
 
 
24
 
25
  Response includes:
26
 
@@ -57,3 +65,35 @@ Behavior:
57
  ```
58
 
59
  Replace `gait-api` with your running container name.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  - `POST /analyze`
21
  - form-data:
22
  - `video`: video file (front-view gait)
23
+ - `gender`: `male` or `female`
24
+
25
+ - `POST /analyze_files`
26
+ - form-data:
27
+ - `video`: video file
28
+ - `gender`: `male` or `female`
29
+
30
+ - `GET /download/{filename}`
31
+ - `GET /health`
32
 
33
  Response includes:
34
 
 
65
  ```
66
 
67
  Replace `gait-api` with your running container name.
68
+
69
+ ## Hugging Face Spaces (Docker) deployment
70
+
71
+ This repository is ready for Docker Spaces deployment. The container now:
72
+
73
+ - listens on `PORT` (default `7860`) required by Spaces
74
+ - starts a background cleanup loop for `/app/runs`
75
+ - launches the API via `scripts/start.sh`
76
+
77
+ Environment variables (optional):
78
+
79
+ - `PORT` (default: `7860`)
80
+ - `CLEANUP_INTERVAL_SECONDS` (default: `1800`)
81
+ - `RUNS_MAX_AGE_MINUTES` (default: `30`)
82
+
83
+ ## GitHub Actions auto-deploy to your HF Space
84
+
85
+ Workflow file:
86
+
87
+ - `.github/workflows/deploy-hf-space.yml`
88
+
89
+ Target Space:
90
+
91
+ - `xplorers/GAIT_API`
92
+
93
+ ### Required GitHub secret
94
+
95
+ Add this repository secret in GitHub:
96
+
97
+ - `HF_TOKEN` = a Hugging Face User Access Token with write permission to `xplorers/GAIT_API`
98
+
99
+ On every push to `main`, GitHub Actions force-pushes this repo to your Space.
app.py CHANGED
@@ -17,7 +17,7 @@ import base64
17
  import io
18
 
19
  app = FastAPI(
20
- title="HEMAS NeuroTrack Gait Analysis API",
21
  description="Clinical gait analysis using MediaPipe Pose estimation",
22
  version="1.0.0"
23
  )
 
17
  import io
18
 
19
  app = FastAPI(
20
+ title="Gait Analysis API",
21
  description="Clinical gait analysis using MediaPipe Pose estimation",
22
  version="1.0.0"
23
  )