This commit is contained in:
2025-08-26 21:07:42 +08:00
parent d6798ef1ee
commit 61e7ffc03b
6 changed files with 13 additions and 13 deletions
+5 -5
View File
@@ -92,7 +92,7 @@ func Start(pythonPath string, threshold float64) (*Detector, error) {
}
// 模型目录:程序运行目录下的 lib(和 application.properties / media-info.db 同一根目录)。
// 服务脚本优先加载 lib/nwfs/320n.onnx;本地没有会自己下载到那里,下载失败再回退用 pip 自带模型。
// 服务脚本优先加载 lib/human_nwfs/320n.onnx;本地没有会自己下载到那里,下载失败再回退用 pip 自带模型。
modelDir := ""
if wd, err := os.Getwd(); err == nil {
modelDir = filepath.Join(wd, "lib")
@@ -285,10 +285,10 @@ func (d *Detector) detectOnce(path string) (score float64, nsfw bool, err error)
return 0, false, err
}
var out struct {
Ok bool `json:"ok"`
Error string `json:"error"`
Nsfw bool `json:"nsfw"`
Score float64 `json:"score"`
Ok bool `json:"ok"`
Error string `json:"error"`
Nsfw bool `json:"nsfw"`
Score float64 `json:"score"`
Detections []map[string]interface{} `json:"detections"`
}
if err := json.Unmarshal(data, &out); err != nil {