Bitband
Search…
Face Recognition API

Introduction

The Bitband Face Recognition API allows ML engineers and software developers to easily analyze face images to understand identifying characteristics, emotions, and many other details.

Getting Started

Find below sample code for getting started with the Face Recognition API.

PHP

1
//php
2
$client = new\GuzzleHttp\Client();
3
$filePath = 'testImage.jpg';
4
$response = $client->request('POST', 'https://api.bitband.com/v1/image-info', [
5
'multipart' => [
6
[
7
'name' => 'image',
8
'contents' => fopen($filePath, 'r'),
9
],
10
],
11
'headers' => [
12
'apiKey' => 'YOUR_API_TOKEN',
13
],
14
]);
Copied!

JavaScript (node.js)

1
//nodejs
2
const request = require('request')
3
4
var formData = {
5
image: fs.createReadStream('testImage.jpg')
6
};
7
8
request.post({
9
url: 'https://api.bitband.com/v1/image-info',
10
headers: {
11
'apiKey': 'YOUR_API_TOKEN',
12
}, formData: formData
13
}, function optionalCallback(err, httpResponse, body) {
14
15
})
Copied!

Ruby

1
//Ruby
2
require'faraday'
3
4
conn =
5
Faraday.new do |f|
6
f.request :multipart
7
f.request :url_encoded
8
f.adapter :net_http
9
end
10
11
conn.headers = {'apiKey': 'YOUR_API_TOKEN'}
12
13
file_io = {'image': Faraday::UploadIO.new('testImage.jpg', 'image/jpeg')}
14
15
conn.post('https://api.bitband.com/v1/image-info', file: file_io)
16
Copied!

Python

1
//Python
2
3
import requests
4
5
url = 'https://api.bitband.com/v1/image-info'
6
files = {'image': open('testImage.jpg', 'rb')}
7
headers = {'apiKey': 'YOUR_API_TOKEN'}
8
r = requests.post(url, files=files, headers=headers)
9
Copied!

Go

1
//Go
2
3
func SendPostRequest(url string, filename string) (string, []byte) {
4
client := &http.Client{}
5
data, err := os.Open(filename)
6
if err != nil {
7
log.Fatal(err)
8
}
9
req, err := http.NewRequest("POST", url, data)
10
if err != nil {
11
log.Fatal(err)
12
}
13
content, err := ioutil.ReadAll(resp.Body)
14
if err != nil {
15
log.Fatal(err)
16
}
17
return resp.Status, content
18
}
19
20
func main() {
21
status, content := SendPostRequest("https://api.bitband.com/v1/image-info","testImage.jpg")
22
fmt.Println(status)
23
fmt.Println(string(content))
24
}
25
Copied!
Last modified 1yr ago