service/library/contentaudit/imageaudit/simulate.go

155 lines
5.8 KiB
Go

package imageaudit
import (
imageaudit "github.com/alibabacloud-go/imageaudit-20191230/v3/client"
teautils "github.com/alibabacloud-go/tea-utils/v2/service"
"github.com/alibabacloud-go/tea/tea"
)
func ImageAudit(req *imageaudit.ScanImageRequest, runtime *teautils.RuntimeOptions) (resp *imageaudit.ScanImageResponse, err error) {
results := make([]*imageaudit.ScanImageResponseBodyDataResults, len(req.Task))
for i := range results {
results[i] = &imageaudit.ScanImageResponseBodyDataResults{
DataId: req.Task[i].DataId,
}
result := results[i]
if i == 0 {
result.SubResults = make([]*imageaudit.ScanImageResponseBodyDataResultsSubResults, 5)
for i := range result.SubResults {
result.SubResults[i] = &imageaudit.ScanImageResponseBodyDataResultsSubResults{}
}
result.SubResults[0].Suggestion = tea.String("review")
result.SubResults[0].Label = tea.String("normal")
result.SubResults[0].Scene = tea.String("porn")
result.SubResults[0].Rate = tea.Float32(99.9)
result.SubResults[1].Suggestion = tea.String("pass")
result.SubResults[1].Label = tea.String("normal")
result.SubResults[1].Scene = tea.String("terrorism")
result.SubResults[1].Rate = tea.Float32(99.9)
result.SubResults[2].Suggestion = tea.String("pass")
result.SubResults[2].Label = tea.String("normal")
result.SubResults[2].Scene = tea.String("ad")
result.SubResults[2].Rate = tea.Float32(92.9)
result.SubResults[3].Suggestion = tea.String("pass")
result.SubResults[3].Label = tea.String("normal")
result.SubResults[3].Scene = tea.String("live")
result.SubResults[3].Rate = tea.Float32(76.9)
result.SubResults[4].Suggestion = tea.String("pass")
result.SubResults[4].Label = tea.String("normal")
result.SubResults[4].Scene = tea.String("logo")
result.SubResults[4].Rate = tea.Float32(86.9)
}
if i == 1 {
result.SubResults = make([]*imageaudit.ScanImageResponseBodyDataResultsSubResults, 5)
for i := range result.SubResults {
result.SubResults[i] = &imageaudit.ScanImageResponseBodyDataResultsSubResults{}
}
result.SubResults[0].Suggestion = tea.String("review")
result.SubResults[0].Label = tea.String("porn")
result.SubResults[0].Scene = tea.String("porn")
result.SubResults[0].Rate = tea.Float32(99.9)
result.SubResults[1].Suggestion = tea.String("pass")
result.SubResults[1].Label = tea.String("normal")
result.SubResults[1].Scene = tea.String("terrorism")
result.SubResults[1].Rate = tea.Float32(99.9)
result.SubResults[2].Suggestion = tea.String("pass")
result.SubResults[2].Label = tea.String("normal")
result.SubResults[2].Scene = tea.String("ad")
result.SubResults[2].Rate = tea.Float32(92.9)
result.SubResults[3].Suggestion = tea.String("pass")
result.SubResults[3].Label = tea.String("normal")
result.SubResults[3].Scene = tea.String("live")
result.SubResults[3].Rate = tea.Float32(76.9)
result.SubResults[4].Suggestion = tea.String("pass")
result.SubResults[4].Label = tea.String("normal")
result.SubResults[4].Scene = tea.String("logo")
result.SubResults[4].Rate = tea.Float32(86.9)
}
if i == 2 {
result.SubResults = make([]*imageaudit.ScanImageResponseBodyDataResultsSubResults, 5)
for i := range result.SubResults {
result.SubResults[i] = &imageaudit.ScanImageResponseBodyDataResultsSubResults{}
}
result.SubResults[0].Suggestion = tea.String("pass")
result.SubResults[0].Label = tea.String("normal")
result.SubResults[0].Scene = tea.String("porn")
result.SubResults[0].Rate = tea.Float32(99.9)
result.SubResults[1].Suggestion = tea.String("review")
result.SubResults[1].Label = tea.String("violence")
result.SubResults[1].Scene = tea.String("terrorism")
result.SubResults[1].Rate = tea.Float32(26.9)
result.SubResults[2].Suggestion = tea.String("block")
result.SubResults[2].Label = tea.String("politics")
result.SubResults[2].Scene = tea.String("ad")
result.SubResults[2].Rate = tea.Float32(92.9)
result.SubResults[3].Suggestion = tea.String("pass")
result.SubResults[3].Label = tea.String("normal")
result.SubResults[3].Scene = tea.String("live")
result.SubResults[3].Rate = tea.Float32(76.9)
result.SubResults[4].Suggestion = tea.String("pass")
result.SubResults[4].Label = tea.String("normal")
result.SubResults[4].Scene = tea.String("logo")
result.SubResults[4].Rate = tea.Float32(86.9)
}
if i == 3 {
result.SubResults = make([]*imageaudit.ScanImageResponseBodyDataResultsSubResults, 5)
for i := range result.SubResults {
result.SubResults[i] = &imageaudit.ScanImageResponseBodyDataResultsSubResults{}
}
result.SubResults[0].Suggestion = tea.String("pass")
result.SubResults[0].Label = tea.String("normal")
result.SubResults[0].Scene = tea.String("porn")
result.SubResults[0].Rate = tea.Float32(99.9)
result.SubResults[1].Suggestion = tea.String("review")
result.SubResults[1].Label = tea.String("violence")
result.SubResults[1].Scene = tea.String("terrorism")
result.SubResults[1].Rate = tea.Float32(26.9)
result.SubResults[2].Suggestion = tea.String("block")
result.SubResults[2].Label = tea.String("politics")
result.SubResults[2].Scene = tea.String("ad")
result.SubResults[2].Rate = tea.Float32(92.9)
result.SubResults[3].Suggestion = tea.String("pass")
result.SubResults[3].Label = tea.String("normal")
result.SubResults[3].Scene = tea.String("live")
result.SubResults[3].Rate = tea.Float32(76.9)
result.SubResults[4].Suggestion = tea.String("pass")
result.SubResults[4].Label = tea.String("normal")
result.SubResults[4].Scene = tea.String("logo")
result.SubResults[4].Rate = tea.Float32(86.9)
}
}
body := &imageaudit.ScanImageResponseBody{
RequestId: tea.String("114514"),
Data: &imageaudit.ScanImageResponseBodyData{
Results: results,
},
}
resp = &imageaudit.ScanImageResponse{
Body: body,
}
return
}