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.
Find below sample code for getting started with the Face Recognition API.
//php$client = new\GuzzleHttp\Client();$filePath = 'testImage.jpg';$response = $client->request('POST', 'https://api.bitband.com/v1/image-info', ['multipart' => [['name' => 'image','contents' => fopen($filePath, 'r'),],],'headers' => ['apiKey' => 'YOUR_API_TOKEN',],]);
//nodejsconst request = require('request')var formData = {image: fs.createReadStream('testImage.jpg')};request.post({url: 'https://api.bitband.com/v1/image-info',headers: {'apiKey': 'YOUR_API_TOKEN',}, formData: formData}, function optionalCallback(err, httpResponse, body) {})
//Rubyrequire'faraday'conn =Faraday.new do |f|f.request :multipartf.request :url_encodedf.adapter :net_httpendconn.headers = {'apiKey': 'YOUR_API_TOKEN'}file_io = {'image': Faraday::UploadIO.new('testImage.jpg', 'image/jpeg')}conn.post('https://api.bitband.com/v1/image-info', file: file_io)
//Pythonimport requestsurl = 'https://api.bitband.com/v1/image-info'files = {'image': open('testImage.jpg', 'rb')}headers = {'apiKey': 'YOUR_API_TOKEN'}r = requests.post(url, files=files, headers=headers)
//Gofunc SendPostRequest(url string, filename string) (string, []byte) {client := &http.Client{}data, err := os.Open(filename)if err != nil {log.Fatal(err)}req, err := http.NewRequest("POST", url, data)if err != nil {log.Fatal(err)}content, err := ioutil.ReadAll(resp.Body)if err != nil {log.Fatal(err)}return resp.Status, content}func main() {status, content := SendPostRequest("https://api.bitband.com/v1/image-info","testImage.jpg")fmt.Println(status)fmt.Println(string(content))}