Spaces:
Sleeping
Sleeping
Sync from GitHub via hub-sync
Browse filesFiles changed (3)
- Dockerfile+8-1
- README.md+28-11
- docker-compose.yml+6-2
5 unmodified lines6789101112131416 unmodified lines3132333134353637385 unmodified lines PYTHONPATH=/app/src \ FACEVERIFICATION_DEVICE=cpu
ARG APP_VARIANT=gradioENV APP_VARIANT=${APP_VARIANT}
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \16 unmodified lines
EXPOSE 8000 7860
CMD ["uvicorn", "faceverification.interfaces.fastapi_app:app", "--host", "0.0.0.0", "--port", "8000"]CMD if [ "$APP_VARIANT" = "fastapi" ]; then \ exec uvicorn faceverification.interfaces.fastapi_app:app --host 0.0.0.0 --port 8000; \ else \ exec python -m faceverification.interfaces.gradio_app; \ fi2 unmodified lines345678967891017 unmodified lines2829303331323334351 unmodified line373839404142424344454613 unmodified lines606162626364656632 unmodified lines9910010110110210210310410510637 unmodified lines14414514614614714814915015115215315415515615715815916016116216316449 unmodified lines2142152162022172182192202212222232242252262 unmodified linesemoji: 🧠colorFrom: bluecolorTo: greensdk: gradiosdk_version: 6.14.0python_version: '3.11'app_file: app.pysdk: dockerapp_port: 7860short_description: "Face verification demo with FaceNet and VectorDB"tags: ["face-verification", "computer-vision", "facenet", "vector-database"]pinned: false17 unmodified lines- FaceNet embedding extraction with PyTorch- Similarity search with ChromaDB- Interactive Gradio UI with add-person and verify-identity flows- Hugging Face Spaces deployment-ready structure- FastAPI interface for containerized API deployments- Docker-based Hugging Face Space deployment
## Tech Stack
1 unmodified line- PyTorch- FaceNet / facenet-pytorch- ChromaDB- FastAPI- Gradio- Docker / GHCR- Hugging Face Spaces- Hugging Face Spaces Docker SDK
## Run Locally
13 unmodified lines
## FastAPI Interface
The project also includes an HTTP API for the same enroll-and-verify workflow.The project includes an HTTP API for the same enroll-and-verify workflow.Run it locally with:
```bash32 unmodified lines
## Deployment Notes
For a containerized deployment, the recommended baseline is the FastAPIcontainer running Uvicorn:For API deployments, the recommended baseline is the FastAPI container runningUvicorn:
```bashuvicorn faceverification.interfaces.fastapi_app:app --host 0.0.0.0 --port 800037 unmodified lines
The Gradio UI will be available at http://localhost:7860.
Both services use the same image. By default, ChromaDB runs in memory, soBoth services are built from the same `Dockerfile` with different variants:
- `fastapi`: published to GHCR by the container workflow.- `gradio`: used by the Hugging Face Docker Space.
The published FastAPI image is tagged as:
```textghcr.io/leandrodevai/faceverification:fastapi```
Each successful container workflow also publishes an immutable SHA tag with the`fastapi-sha-*` prefix.
By default, ChromaDB runs in memory, soenrolled faces are ephemeral and disappear when the container restarts. This isintentional for the demo baseline.
49 unmodified lines
```textsrc/faceverification/ app.py config.py core/ image_processor.py vectordb.py interfaces/ fastapi_app.py gradio_app.py services/ face_verification.py```1 unmodified line2345657891012 unmodified lines232425262724282930311 unmodified line api: build: context: . args: APP_VARIANT: fastapi image: faceverification image: faceverification:fastapi command: uvicorn faceverification.interfaces.fastapi_app:app --host 0.0.0.0 --port 8000 ports: - "8000:8000"12 unmodified lines gradio: build: context: . args: APP_VARIANT: gradio image: faceverification image: faceverification:gradio command: python -m faceverification.interfaces.gradio_app profiles: - gradioDockerfile+8-1
README.md+28-11
docker-compose.yml+6-2