Spaces:
Runtime error

AnnSankavi commited on
Commit
2c2d72d
ยท
1 Parent(s): 7d566ee

Fix Space configuration

Browse files
Files changed (1) hide show
  1. README.md +15 -116
README.md CHANGED
@@ -1,122 +1,21 @@
1
- # Face Verification API
 
 
 
 
 
 
 
2
 
3
- A self-hosted Python backend for face enrollment and authentication, replacing FaceIO.
4
 
5
- ## Prerequisites
6
 
7
- - Python 3.9+
8
- - pip (Python package manager)
9
- - CMake and dlib dependencies (required for face_recognition)
10
 
11
- ### Windows Setup
 
12
 
13
- 1. Install Visual Studio Build Tools with C++ development tools
14
- 2. Install CMake: `winget install cmake`
15
 
16
- ### Linux/Mac Setup
17
-
18
- ```bash
19
- # Ubuntu/Debian
20
- sudo apt-get install build-essential cmake
21
-
22
- # macOS
23
- brew install cmake
24
- ```
25
-
26
- ## Installation
27
-
28
- ```bash
29
- cd services/face-api
30
-
31
- # Create virtual environment
32
- python -m venv venv
33
-
34
- # Activate virtual environment
35
- # Windows:
36
- venv\Scripts\activate
37
- # Linux/Mac:
38
- source venv/bin/activate
39
-
40
- # Install dependencies
41
- pip install -r requirements.txt
42
- ```
43
-
44
- ## Configuration
45
-
46
- Copy `.env.example` to `.env` and adjust settings:
47
-
48
- ```bash
49
- cp .env.example .env
50
- ```
51
-
52
- Configuration options:
53
- - `FACE_MATCH_THRESHOLD`: Face matching strictness (0.6 recommended)
54
- - `ALLOWED_ORIGINS`: CORS origins (comma-separated)
55
- - `PORT`: Server port (default: 8000)
56
-
57
- ## Running the Server
58
-
59
- ```bash
60
- # Development with auto-reload
61
- python -m uvicorn main:app --reload --host 0.0.0.0 --port 8000
62
-
63
- # Production
64
- python main.py
65
- ```
66
-
67
- ## API Endpoints
68
-
69
- ### Health Check
70
- ```
71
- GET /health
72
- ```
73
-
74
- ### Enroll Face
75
- ```
76
- POST /enroll
77
- Content-Type: application/json
78
-
79
- {
80
- "image_base64": "base64_encoded_image",
81
- "user_id": "user_uuid",
82
- "metadata": {} // optional
83
- }
84
- ```
85
-
86
- Response:
87
- ```json
88
- {
89
- "success": true,
90
- "face_id": "face_user_uuid_timestamp",
91
- "face_embedding": [128 float values],
92
- "message": "Face enrolled successfully"
93
- }
94
- ```
95
-
96
- ### Verify Face
97
- ```
98
- POST /verify
99
- Content-Type: application/json
100
-
101
- {
102
- "image_base64": "base64_encoded_image",
103
- "stored_embedding": [128 float values],
104
- "user_id": "user_uuid" // optional
105
- }
106
- ```
107
-
108
- Response:
109
- ```json
110
- {
111
- "success": true,
112
- "match": true,
113
- "confidence": 0.85,
114
- "message": "Face verified successfully"
115
- }
116
- ```
117
-
118
- ## Testing
119
-
120
- ```bash
121
- curl http://localhost:8000/health
122
- ```
 
1
+ ---
2
+ title: Face API
3
+ emoji: ๐Ÿ˜Ž
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ pinned: false
8
+ ---
9
 
10
+ # Face Recognition API
11
 
12
+ This is a FastAPI-based Face Recognition service deployed on Hugging Face Spaces using Docker.
13
 
14
+ ## Endpoints
 
 
15
 
16
+ - `/health` โ†’ API health check
17
+ - `/verify-face` โ†’ Face verification endpoint
18
 
19
+ ## Usage
 
20
 
21
+ This API is used by the Attendance App to verify users via face recognition.