Skip to content

Commit 5e8d7c7

Browse files
committed
allow tts param definition in config file
- consolidate TTS options under `tts` config entry Signed-off-by: blob42 <[email protected]>
1 parent b1719e6 commit 5e8d7c7

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

core/config/backend_config.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ const (
1515
RAND_SEED = -1
1616
)
1717

18+
type TTSConfig struct {
19+
20+
// Voice wav path or id
21+
Voice string `yaml:"voice"`
22+
23+
// Vall-e-x
24+
VallE VallE `yaml:"vall-e"`
25+
}
26+
1827
type BackendConfig struct {
1928
schema.PredictionOptions `yaml:"parameters"`
2029
Name string `yaml:"name"`
@@ -49,8 +58,8 @@ type BackendConfig struct {
4958
// GRPC Options
5059
GRPC GRPC `yaml:"grpc"`
5160

52-
// Vall-e-x
53-
VallE VallE `yaml:"vall-e"`
61+
// TTS specifics
62+
TTSConfig `yaml:"tts"`
5463

5564
// CUDA
5665
// Explicitly enable CUDA or not (some backends might need it)

core/http/endpoints/localai/tts.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func TTSEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfi
4343
)
4444

4545
if err != nil {
46+
log.Err(err)
4647
modelFile = input.Model
4748
log.Warn().Msgf("Model not found in context: %s", input.Model)
4849
} else {
@@ -54,7 +55,15 @@ func TTSEndpoint(cl *config.BackendConfigLoader, ml *model.ModelLoader, appConfi
5455
cfg.Backend = input.Backend
5556
}
5657

57-
filePath, _, err := backend.ModelTTS(cfg.Backend, input.Input, modelFile, input.Voice, input.Language, ml, appConfig, *cfg)
58+
if input.Language != "" {
59+
cfg.Language = input.Language
60+
}
61+
62+
if input.Voice != "" {
63+
cfg.Voice = input.Voice
64+
}
65+
66+
filePath, _, err := backend.ModelTTS(cfg.Backend, input.Input, modelFile, cfg.Voice, cfg.Language, ml, appConfig, *cfg)
5867
if err != nil {
5968
return err
6069
}

0 commit comments

Comments
 (0)