We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 47737b2 commit beb9512Copy full SHA for beb9512
1 file changed
bindings/go/pkg/whisper/context.go
@@ -117,6 +117,17 @@ func (context *context) PrintTimings() {
117
context.model.ctx.Whisper_print_timings()
118
}
119
120
+// Use mel data at offset_ms to try and auto-detect the spoken language
121
+// Make sure to call whisper_pcm_to_mel() or whisper_set_mel() first.
122
+// Returns the probabilities of all languages.
123
+func (context *context) WhisperLangAutoDetect(offset_ms int, n_threads int) ([]float32, error) {
124
+ langProbs, err := context.model.ctx.Whisper_lang_auto_detect(offset_ms, n_threads)
125
+ if err != nil {
126
+ return nil, err
127
+ }
128
+ return langProbs, nil
129
+}
130
+
131
// Process new sample data and return any errors
132
func (context *context) Process(data []float32, cb SegmentCallback) error {
133
if context.model.ctx == nil {
0 commit comments