whisper.cpp
whisper.cpp copied to clipboard
Add function to get the final (auto-detected) language
When you set the language to auto-detect, whisper_full()
sets params.languages
to the detected language. The problem is that this is only available after whisper_full()
has run, which is after the whole transcription. I would like to show the user the detected language right away. I'm planning to do this in the first new_segment_callback
callback call. It would be useful to have a function whisper_get_language(context)
that returns the language ID. I could then call this function inside new_segment_callback
.
Testing the wasm version within a browser Im able to see the language in the first place via console
whisper_full: auto-detected language: es (p = 0.897221)
@sindresorhus This function was added recently (a1c1583cc7cd8b75222857afc936f0638c5683d6) but this issue wasn't tagged:
https://github.com/ggerganov/whisper.cpp/blob/09e90680072d8ecdf02eaf21c393218385d2c616/whisper.h#L422-L425
@ggerganov Thanks for adding that 👍