-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
45 lines (35 loc) · 852 Bytes
/
main.go
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
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"github.com/glair-ai/glair-vision-go"
"github.com/glair-ai/glair-vision-go/client"
)
func main() {
ctx := context.Background()
config := glair.NewConfig("", "", "")
client := client.New(config)
image, _ := os.Open("../images/face.jpeg")
result, err := client.FaceBio.FaceMatching(ctx, glair.FaceMatchingInput{
StoredImage: image,
CapturedImage: image,
})
if err != nil {
if glairErr, ok := err.(*glair.Error); ok {
switch glairErr.Code {
case glair.ErrorCodeAPIError:
log.Printf("API Error: %v\n", glairErr.Response)
default:
log.Printf("Error: %v\n", glairErr.Code)
}
} else {
log.Printf("Unexpected Error: %v\n", err)
}
os.Exit(1)
}
beautified, _ := json.MarshalIndent(result, "", " ")
fmt.Println(string(beautified))
}