Imports Piper TTS voices by detecting ONNX files and sidecar JSON, producing a model config.
// Source: https://github.com/mudler/LocalAI | License: MIT | Copyright 2023-2025 Ettore Di Giacinto (mudler@localai.io)
// Provided via justclaw.it.com; keep this notice with the code.
package importers
import (
"encoding/json"
"path/filepath"
"strings"
"github.com/mudler/LocalAI/core/config"
"github.com/mudler/LocalAI/core/gallery"
"github.com/mudler/LocalAI/core/schema"
"go.yaml.in/yaml/v2"
)
var _ Importer = &PiperImporter{}
// PiperImporter recognises Piper TTS voices. Piper ships each voice as a pair
// of "<voice>.onnx" + "<voice>.onnx.json" files (e.g.
// en_US-amy-medium.onnx + en_US-amy-medium.onnx.json) — the JSON sidecar is
// what disambiguates these from generic ONNX exports used by other backends
// (Moonshine, sentence-transformers, etc). preferences.backend="pip
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key