mirror of
https://github.com/mudler/LocalAI.git
synced 2024-12-21 13:37:51 +00:00
21 lines
327 B
Go
21 lines
327 B
Go
|
package tts
|
||
|
|
||
|
import "os"
|
||
|
|
||
|
type Piper struct {
|
||
|
assetDir string
|
||
|
}
|
||
|
|
||
|
func New(assetDir string) (*Piper, error) {
|
||
|
if _, err := os.Stat(assetDir); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return &Piper{
|
||
|
assetDir: assetDir,
|
||
|
}, nil
|
||
|
}
|
||
|
|
||
|
func (s *Piper) TTS(text, model, dst string) error {
|
||
|
return tts(text, model, s.assetDir, "", dst)
|
||
|
}
|