File size: 2,726 Bytes
6968f16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Quick Start Guide</title>
    <link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
    <div class="container">
        <div class="sidebar">
            <h1>Face Recognition API</h1>
            <ul>
                <li><a href="/">Home</a></li>
                <li><a href="/docs">API Docs</a></li>
                <li><a href="/quickstart">Quick Start</a></li>
            </ul>
        </div>
        <div class="main-content">
            <h1>Quick Start Guide</h1>
            <p>This guide will walk you through the basics of using the Face Recognition API.</p>

            <h2>Authentication</h2>
            <p>The API uses JWT for authentication. You'll need to include your JWT in the `Authorization` header of your requests.</p>
            <pre><code>Authorization: Bearer YOUR_JWT</code></pre>

            <h2>Endpoints</h2>
            <p>The API has the following main endpoints:</p>
            <ul>
                <li><code>/api/v1/faces/register</code>: Register a new face.</li>
                <li><code>/api/v1/faces/recognize</code>: Recognize a face in an image.</li>
                <li><code>/api/v1/faces/recognize-video</code>: Recognize faces in a video.</li>
            </ul>

            <h2>Examples</h2>
            <p>Here are some examples of how to use the API in different languages.</p>

            <h3>Python</h3>
            <pre><code>import requests

image_path = 'path/to/your/image.jpg'
url = 'http://localhost:8000/api/v1/faces/recognize'
headers = {'Authorization': 'Bearer YOUR_JWT'}

with open(image_path, 'rb') as f:
    files = {'image': f}
    response = requests.post(url, headers=headers, files=files)

print(response.json())</code></pre>

            <h3>JavaScript (Node.js)</h3>
            <pre><code>const axios = require('axios');
const fs = require('fs');
const FormData = require('form-data');

const imagePath = 'path/to/your/image.jpg';
const url = 'http://localhost:8000/api/v1/faces/recognize';
const token = 'YOUR_JWT';

const form = new FormData();
form.append('image', fs.createReadStream(imagePath));

axios.post(url, form, {
    headers: {
        ...form.getHeaders(),
        'Authorization': `Bearer ${token}`
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});</code></pre>

            <h3>cURL</h3>
            <pre><code>curl -X POST \
  http://localhost:8000/api/v1/faces/recognize \
  -H 'Authorization: Bearer YOUR_JWT' \
  -F 'image=@/path/to/your/image.jpg'</code></pre>
        </div>
    </div>
</body>
</html>