blob: 1002a9745dcc3fb46fae3fa87edb533ff5bc5e17 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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,
}
}
|