File size: 985 Bytes
295de00
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from typing import List
from src import modelCache
from src.config import ModelConfig
from src.whisper.abstractWhisperContainer import AbstractWhisperContainer

def create_whisper_container(whisper_implementation: str, 
                             model_name: str, device: str = None, download_root: str = None,
                             cache: modelCache = None, models: List[ModelConfig] = []) -> AbstractWhisperContainer:
    if (whisper_implementation == "whisper"):
        from src.whisper.whisperContainer import WhisperContainer
        return WhisperContainer(model_name, device, download_root, cache, models)
    elif (whisper_implementation == "faster-whisper" or whisper_implementation == "faster_whisper"):
        from src.whisper.fasterWhisperContainer import FasterWhisperContainer
        return FasterWhisperContainer(model_name, device, download_root, cache, models)
    else:
        raise ValueError("Unknown Whisper implementation: " + whisper_implementation)