File size: 2,015 Bytes
85540c7
8b36516
 
 
 
85540c7
 
 
 
 
8b36516
 
b78b643
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
---
title: Face Detection API
emoji: 👤
colorFrom: yellow
colorTo: blue
sdk: docker
pinned: false
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

This project provides a face detection API using FastAPI and OpenCV.

## Run the Application

To run the application, follow these steps:

### Using Docker

1. **Build the Docker image**:
   ```bash
   docker build -t face-detection-api .
   ```

2. **Run the Docker container**:
   ```bash
   docker run -p 7860:7860 face-detection-api
   ```

3. **Access the API** at `http://localhost:7860/predict/` to make predictions.

### Using Docker Compose

Alternatively, you can use Docker Compose to manage the application:

1. **Build and run the application**:
   ```bash
   docker-compose up --build
   ```

2. **Access the API** at `http://localhost:7860/predict/` to make predictions.

3. **Stop the application**:
   ```bash
   docker-compose down
   ```

## Docker Container Guide

This project uses Docker to create a containerized environment for the Face Detection API. Below are the steps to manage the Docker container:

### Building the Docker Image

- Ensure you are in the project directory where the `Dockerfile` is located.
- Run the following command to build the Docker image:
  ```bash
  docker build -t face-detection-api .
  ```

### Running the Docker Container

- After building the image, you can run the container using:
  ```bash
  docker run -p 7860:7860 face-detection-api
  ```

### Stopping the Docker Container

- To stop the running container, you can use:
  ```bash
  docker ps  # to find the container ID
  docker stop <container_id>
  ```

### Removing the Docker Container

- If you want to remove the stopped container, use:
  ```bash
  docker rm <container_id>
  ```

### Removing the Docker Image

- To remove the Docker image, run:
  ```bash
  docker rmi face-detection-api
  ```

This guide should help you manage the Docker container for the Face Detection API effectively.