feat(ImageToText): add ImageToText task support

sati.ac 2023-08-31 18:49:27 +03:00
parent 286e5aa6e5
commit e4f2430729
1 changed files with 27 additions and 0 deletions

View File

@ -1,5 +1,9 @@
package sati
import (
"encoding/base64"
)
type AnyTask interface {
serialize() task
Result() any
@ -101,3 +105,26 @@ type GeeTest3Result struct {
Validate string `json:"validate"`
Seccode string `json:"seccode"`
}
type ImageToTextTask struct {
Image []byte `json:"-"`
Type string `json:"type"`
}
func (t *ImageToTextTask) serialize() task {
return task{
Type: "ImageToText",
Data: map[string]string{
"image": base64.RawStdEncoding.EncodeToString(t.Image),
"type": t.Type,
},
}
}
func (t *ImageToTextTask) Result() any {
return &ImageToTextResult{}
}
type ImageToTextResult struct {
Result string `json:"result"`
}