Spaces:
Sleeping
Sleeping
from transformers import WhisperProcessor, WhisperForConditionalGeneration | |
def load_model_and_processor(model_name="openai/whisper-base"): | |
""" | |
Loads the Whisper model and processor. | |
Parameters: | |
model_name (str): The model to load. Defaults to 'openai/whisper-base'. | |
Returns: | |
model (WhisperForConditionalGeneration): Loaded Whisper model. | |
processor (WhisperProcessor): Loaded processor for the model. | |
""" | |
model = WhisperForConditionalGeneration.from_pretrained(model_name) | |
processor = WhisperProcessor.from_pretrained(model_name) | |
return model, processor | |