https://github.com/rohan1279/fast-api-face-recognition
https://github.com/rohan1279/fast-api-face-recognition
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rohan1279/fast-api-face-recognition
- Owner: Rohan1279
- License: mit
- Created: 2024-10-21T05:30:42.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-10-30T01:06:11.000Z (7 months ago)
- Last Synced: 2025-01-18T14:44:31.830Z (5 months ago)
- Language: Python
- Size: 40 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# FastAPI Face Recognition
![]()
![]()
![]()
This project provides a docker image with a FastAPI backend that uses the `face_recognition` library to detect faces in images. The backend is containerized using Docker.
## Prerequisites
- Docker
- Docker Compose (optional)## Getting Started
### Build the Docker Image
To build the Docker image, run the following command:
```sh
docker build -t fastapi-face-recognition .
```## Run the Docker Container
To run the Docker container, use the following command:
```sh
docker run -p 8000:8000 fastapi-face-recognition
```## Using Docker Compose
Alternatively, you can use Docker Compose to build and run the container.
1. Build and start the services:
```sh
docker-compose up --build
```2. Run the service:
```sh
docker run fastapi-face-recognition
```3. Stop the services:
```sh
docker-compose down
```## Test the Endpoint
You can test the /detect-faces/ endpoint using tools like curl, httpie, or Postman.
```sh
curl -X POST "http://localhost:8000/detect-faces/" -F "file=@path/to/your/image.jpg"
```## Using Postman
1. Open Postman and create a new POST request.
2. Set the URL to http://localhost:8000/detect-faces/.
3. In the "Body" tab, select "form-data".
4. Add a key named file and set its type to "File".
5. Choose the image file you want to upload.
6. Click "Send" to send the request.## Project Structure
- images/: Contains the images used for testing.
- Dockerfile: Contains the instructions to build the Docker image.
- requirements.txt: Lists the Python dependencies.
- index.py: The main FastAPI application file.