feat: add facepp
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 26s
CI / admin (push) Successful in 17s
CI / analysis (push) Successful in 24s
CI / bff (push) Successful in 16s
CI / chore (push) Successful in 14s
CI / equipment (push) Successful in 15s
CI / express (push) Successful in 13s
CI / factory (push) Successful in 13s
CI / message (push) Successful in 10s
CI / order (push) Successful in 10s
CI / payment (push) Successful in 11s
CI / percutaneous (push) Successful in 11s
CI / product (push) Successful in 12s
CI / record (push) Successful in 12s
CI / sale (push) Successful in 11s
CI / store (push) Successful in 11s
CI / support (push) Successful in 11s
CI / task (push) Successful in 10s
CI / user (push) Successful in 18s
CI / water (push) Successful in 13s
CI / wecom (push) Successful in 13s
CI / ws (push) Successful in 6s
CI / changes (push) Successful in 1m31s
CI / ad (push) Successful in 26s
CI / admin (push) Successful in 17s
CI / analysis (push) Successful in 24s
CI / bff (push) Successful in 16s
CI / chore (push) Successful in 14s
CI / equipment (push) Successful in 15s
CI / express (push) Successful in 13s
CI / factory (push) Successful in 13s
CI / message (push) Successful in 10s
CI / order (push) Successful in 10s
CI / payment (push) Successful in 11s
CI / percutaneous (push) Successful in 11s
CI / product (push) Successful in 12s
CI / record (push) Successful in 12s
CI / sale (push) Successful in 11s
CI / store (push) Successful in 11s
CI / support (push) Successful in 11s
CI / task (push) Successful in 10s
CI / user (push) Successful in 18s
CI / water (push) Successful in 13s
CI / wecom (push) Successful in 13s
CI / ws (push) Successful in 6s
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
package facepp
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// SkinAnalyzeOptions 专业版请求参数。
|
||||
type SkinAnalyzeOptions struct {
|
||||
ImageURL string
|
||||
ImageBase64 string
|
||||
ImageFile string
|
||||
ReturnMaps string
|
||||
ReturnMarks string
|
||||
}
|
||||
|
||||
type APIError struct {
|
||||
TimeUsed int `json:"time_used"`
|
||||
RequestID string `json:"request_id"`
|
||||
ErrorMessage string `json:"error_message"`
|
||||
}
|
||||
|
||||
func (e *APIError) Error() string {
|
||||
if e.RequestID == "" {
|
||||
return fmt.Sprintf("facepp: %s", e.ErrorMessage)
|
||||
}
|
||||
return fmt.Sprintf("facepp: %s (request_id=%s)", e.ErrorMessage, e.RequestID)
|
||||
}
|
||||
|
||||
type SkinAnalyzeResponse struct {
|
||||
RequestID string `json:"request_id"`
|
||||
TimeUsed int `json:"time_used"`
|
||||
ErrorMessage string `json:"error_message"`
|
||||
ImageID string `json:"image_id"`
|
||||
FaceRectangle FaceRectangle `json:"face_rectangle"`
|
||||
Result json.RawMessage `json:"result"`
|
||||
LeftSideResult json.RawMessage `json:"left_side_result"`
|
||||
RightSideResult json.RawMessage `json:"right_side_result"`
|
||||
FaceMaps FaceMaps `json:"face_maps,omitempty"`
|
||||
Warning []string `json:"warning,omitempty"`
|
||||
}
|
||||
|
||||
type FaceRectangle struct {
|
||||
Top int `json:"top"`
|
||||
Left int `json:"left"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}
|
||||
|
||||
type FlagResult struct {
|
||||
Value int `json:"value"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
}
|
||||
|
||||
type LocatedResult struct {
|
||||
Value int `json:"value"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
Rect []Rect `json:"rect,omitempty"`
|
||||
}
|
||||
|
||||
type Rect struct {
|
||||
Top int `json:"top"`
|
||||
Left int `json:"left"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}
|
||||
|
||||
type SkinTypeResult struct {
|
||||
SkinType int `json:"skin_type"`
|
||||
Details map[string]FlagResult `json:"details"`
|
||||
}
|
||||
|
||||
type DarkCircleResult struct {
|
||||
Value int `json:"value"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
DarkCircleType int `json:"dark_circle_type"`
|
||||
}
|
||||
|
||||
type SkinAgeResult struct {
|
||||
Value int `json:"value"`
|
||||
}
|
||||
|
||||
type FineLineRegion struct {
|
||||
Count int `json:"count"`
|
||||
Area float64 `json:"area"`
|
||||
}
|
||||
|
||||
type FineLineResult struct {
|
||||
Value int `json:"value"`
|
||||
Forehead FineLineRegion `json:"forehead"`
|
||||
UnderEye FineLineRegion `json:"under_eye"`
|
||||
}
|
||||
|
||||
type FaceMaps struct {
|
||||
RedArea string `json:"red_area,omitempty"`
|
||||
BrownArea string `json:"brown_area,omitempty"`
|
||||
TextureEnhancedPores string `json:"texture_enhanced_pores,omitempty"`
|
||||
TextureEnhancedLines string `json:"texture_enhanced_lines,omitempty"`
|
||||
}
|
||||
|
||||
type AnalyzeResult struct {
|
||||
SkinType SkinTypeResult `json:"skin_type"`
|
||||
OilyIntensity FlagResult `json:"oily_intensity"`
|
||||
SkinColor FlagResult `json:"skin_color"`
|
||||
SkinTone FlagResult `json:"skin_tone"`
|
||||
Sensitivity FlagResult `json:"sensitivity"`
|
||||
ClosedComedones LocatedResult `json:"closed_comedones"`
|
||||
Blackhead FlagResult `json:"blackhead"`
|
||||
BlackheadCount int `json:"blackhead_count"`
|
||||
Mole LocatedResult `json:"mole"`
|
||||
SkinSpot LocatedResult `json:"skin_spot"`
|
||||
Acne LocatedResult `json:"acne"`
|
||||
DarkCircle DarkCircleResult `json:"dark_circle"`
|
||||
EyePouch FlagResult `json:"eye_pouch"`
|
||||
ForeheadWrinkle FlagResult `json:"forehead_wrinkle"`
|
||||
CrowsFeet FlagResult `json:"crows_feet"`
|
||||
EyeFinelines FlagResult `json:"eye_finelines"`
|
||||
GlabellaWrinkle FlagResult `json:"glabella_wrinkle"`
|
||||
NasolabialFold FlagResult `json:"nasolabial_fold"`
|
||||
PoresForehead FlagResult `json:"pores_forehead"`
|
||||
PoresLeftCheek FlagResult `json:"pores_left_cheek"`
|
||||
PoresRightCheek FlagResult `json:"pores_right_cheek"`
|
||||
PoresJaw FlagResult `json:"pores_jaw"`
|
||||
SkinAge SkinAgeResult `json:"skin_age"`
|
||||
FineLine FineLineResult `json:"fine_line"`
|
||||
Melanin FlagResult `json:"melanin"`
|
||||
}
|
||||
Reference in New Issue
Block a user