Chore: stt reworks [WIP]
This commit is contained in:
31
extra/whisper_binary.go
Normal file
31
extra/whisper_binary.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package extra
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gf-lt/config"
|
||||
"log/slog"
|
||||
"os/exec"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type WhisperBinary struct {
|
||||
whisperPath string
|
||||
modelPath string
|
||||
lang string
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
mu sync.Mutex
|
||||
running bool
|
||||
cmd *exec.Cmd
|
||||
}
|
||||
|
||||
func NewWhisperBinary(logger *slog.Logger, cfg *config.Config) *WhisperBinary {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
return &WhisperBinary{
|
||||
whisperPath: cfg.WhisperBinaryPath,
|
||||
modelPath: cfg.WhisperModelPath,
|
||||
lang: cfg.STT_LANG,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user