whisper: add tests and allow to set upload size (#237)

This commit is contained in:
Ettore Di Giacinto authored and GitHub committed 2023-05-12 10:04:20 +02:00
1 parent 5115b2faa3
commit fd1df4e971
7 files changed
+53 -21

No files matched your search

+5 -1
View File
@@ -28,7 +28,7 @@ func audioToWav(src, dst string) error {
return nil
}
func Transcript(model whisper.Model, audiopath, language string) (string, error) {
func Transcript(model whisper.Model, audiopath, language string, threads uint) (string, error) {
dir, err := os.MkdirTemp("", "whisper")
if err != nil {
@@ -65,8 +65,12 @@ func Transcript(model whisper.Model, audiopath, language string) (string, error)
}
context.SetThreads(threads)
if language != "" {
context.SetLanguage(language)
} else {
context.SetLanguage("auto")
}
if err := context.Process(data, nil); err != nil {