Keep whisper models in memory (#233)

This commit is contained in:
Matthew Campbell authored and GitHub committed 2023-05-11 14:05:07 +02:00
1 parent 6b5e2b2bf5
commit 032dee256f
3 files changed
+49 -12

No files matched your search

+6 -1
View File
@@ -436,7 +436,12 @@ func transcriptEndpoint(cm ConfigMerger, debug bool, loader *model.ModelLoader,
log.Debug().Msgf("Audio file copied to: %+v", dst)
tr, err := whisper.Transcript(filepath.Join(loader.ModelPath, config.Model), dst, input.Language)
whisperModel, err := loader.WhisperLoader("whisper", config.Model)
if err != nil {
return c.Status(http.StatusBadRequest).JSON(fiber.Map{"error": err.Error()})
}
tr, err := whisper.Transcript(whisperModel, dst, input.Language)
if err != nil {
return c.Status(http.StatusBadRequest).JSON(fiber.Map{"error": err.Error()})
}