Skip to content

henkman/faceapp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

faceapp

small package for faceapp

import (
	"os"
	"github.com/henkman/faceapp"
)

func main() {
	var s faceapp.Session
	if err := s.Init(); err != nil {
		panic(err)
	}
	var code string
	{
		fd, err := os.Open("test/bill.jpg")
		if err != nil {
			panic(err)
		}
		temp, err := s.UploadImage(fd)
		fd.Close()
		if err != nil {
			panic(err)
		}
		code = temp
	}
	{
		for _, fil := range []Filter{
			FilterSmile,
			FilterSmile2,
			FilterHot,
			FilterOld,
			FilterYoung,
			FilterFemale,
			FilterMale,
			FilterBlack,
			FilterCaucasian,
			FilterAsian,
			FilterIndian,
		} {
			fd, err := os.OpenFile("test/bill_"+string(fil)+".jpg",
				os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0750)
			if err != nil {
				panic(err)
			}
			if err := s.GetImage(fd, code, fil, false); err != nil {
				fd.Close()
				panic(err)
			}
			fd.Close()
		}
	}
}

original: alt original

smile: alt smile

smile_2: alt smile_2

hot: alt hot

old: alt old

female: alt female

male: alt male

black: alt black

caucasian: alt caucasian

asian: alt asian

indian: alt indian