Upload 4 files
Browse files- Dockerfile +15 -0
- README.md +11 -0
- main.py +9 -0
- requirements.txt +4 -0
Dockerfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a lightweight Python base image
|
| 2 |
+
FROM python:3.11-slim
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
WORKDIR /code
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
COPY requirements.txt .
|
| 9 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 10 |
+
|
| 11 |
+
COPY . .
|
| 12 |
+
|
| 13 |
+
EXPOSE 7860
|
| 14 |
+
|
| 15 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 💤 Drowsiness Detection API
|
| 2 |
+
|
| 3 |
+
A minimal FastAPI backend to log and track drowsiness events. Built for lean deployment on Hugging Face Spaces.
|
| 4 |
+
|
| 5 |
+
## 🚀 Features
|
| 6 |
+
|
| 7 |
+
- `POST /detect` → Log a new drowsiness event
|
| 8 |
+
- `GET /events` → View all logged events
|
| 9 |
+
- `GET /stats` → Summary stats by status
|
| 10 |
+
|
| 11 |
+
## 🧱 Folder Structure
|
main.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
from app.api.api import router
|
| 3 |
+
from app.db.init_db import init_db
|
| 4 |
+
|
| 5 |
+
app = FastAPI(title="Drowsiness Detection API")
|
| 6 |
+
|
| 7 |
+
init_db()
|
| 8 |
+
|
| 9 |
+
app.include_router(router)
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
fastapi==0.110.0
|
| 2 |
+
uvicorn==0.29.0
|
| 3 |
+
sqlalchemy==2.0.29
|
| 4 |
+
pydantic==2.7.1
|