Nik Afiq 5238298b55
Some checks failed
CI / test (push) Successful in 6s
CI / build-ai-gateway (push) Failing after 28s
CI / build-ha-gateway (push) Failing after 24s
CI / build-discord-bot (push) Failing after 29s
Add TTS model components and inference server
- Implemented core model components in `modules.py` including various convolutional layers and normalization techniques.
- Added transformation functions in `transforms.py` for piecewise rational quadratic transformations.
- Created utility functions in `utils.py` for checkpoint management, logging, and hyperparameter handling.
- Introduced monotonic alignment functionality with Cython optimization in `monotonic_align`.
- Developed a minimal inference server in `server.py` to handle synthesis requests.
- Updated requirements to include necessary dependencies for Cython and scipy.
2026-07-24 22:38:36 +09:00

44 lines
1.5 KiB
Go

package config
import "os"
// Config holds runtime configuration for the TTS gRPC gateway.
type Config struct {
GRPCPort string // GRPC_PORT, default "50053"
TLSDir string // TLS_DIR, empty disables mTLS for local dev
OTELEndpoint string // OTEL_ENDPOINT, e.g. "otel-collector.monitoring.svc:4317"
LogLevel string // LOG_LEVEL, default "info"
LogFormat string // LOG_FORMAT, default "json"
OpenJTalkBin string // OPEN_JTALK_BIN, default "open_jtalk"
OpenJTalkDictDir string // OPEN_JTALK_DICT_DIR, empty auto-discovers under /usr and /var
OpenJTalkVoice string // OPEN_JTALK_VOICE, empty auto-discovers the first *.htsvoice found
InferenceSidecarAddr string // INFERENCE_SIDECAR_ADDR, e.g. "localhost:50054"
}
// Load reads configuration from environment variables and applies defaults.
func Load() (*Config, error) {
return &Config{
GRPCPort: getenvDefault("GRPC_PORT", "50053"),
TLSDir: os.Getenv("TLS_DIR"),
OTELEndpoint: os.Getenv("OTEL_ENDPOINT"),
LogLevel: getenvDefault("LOG_LEVEL", "info"),
LogFormat: getenvDefault("LOG_FORMAT", "json"),
OpenJTalkBin: getenvDefault("OPEN_JTALK_BIN", "open_jtalk"),
OpenJTalkDictDir: os.Getenv("OPEN_JTALK_DICT_DIR"),
OpenJTalkVoice: os.Getenv("OPEN_JTALK_VOICE"),
InferenceSidecarAddr: getenvDefault("INFERENCE_SIDECAR_ADDR", "localhost:50054"),
}, nil
}
// getenvDefault keeps config loading concise for optional variables with defaults.
func getenvDefault(key, fallback string) string {
if v := os.Getenv(key); v != "" {
return v
}
return fallback
}