mirror of
https://github.com/mudler/LocalAI.git
synced 2025-05-30 23:44:59 +00:00
whisper: add tests and allow to set upload size (#237)
This commit is contained in:
parent
5115b2faa3
commit
fd1df4e971
7 changed files with 53 additions and 21 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue