summaryrefslogtreecommitdiff
path: root/extra/whisper_binary.go
diff options
context:
space:
mode:
Diffstat (limited to 'extra/whisper_binary.go')
-rw-r--r--extra/whisper_binary.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/extra/whisper_binary.go b/extra/whisper_binary.go
new file mode 100644
index 0000000..1002a97
--- /dev/null
+++ b/extra/whisper_binary.go
@@ -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,
+ }
+}