Files
photoprism/internal/ai/tensorflow/model.go
2025-04-14 16:45:06 +02:00

21 lines
482 B
Go

package tensorflow
import (
"path/filepath"
tf "github.com/tensorflow/tensorflow/tensorflow/go"
"github.com/photoprism/photoprism/pkg/clean"
)
// SavedModel loads a saved TensorFlow model from the specified path.
func SavedModel(modelPath string, tags []string) (model *tf.SavedModel, err error) {
log.Infof("tensorflow: loading %s", clean.Log(filepath.Base(modelPath)))
if len(tags) == 0 {
tags = []string{"serve"}
}
return tf.LoadSavedModel(modelPath, tags, nil)
}