Spaces:
Sleeping
Sleeping
File size: 572 Bytes
9712d04 780954b 9712d04 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from abc import ABC, abstractmethod
from typing import Optional
import numpy as np
class AbstractASRModel(ABC):
def __init__(
self, model_id: str, device: str = "auto", cache_dir: str = "cache", **kwargs
):
print(f"Loading ASR model {model_id}...")
self.model_id = model_id
self.device = device
self.cache_dir = cache_dir
@abstractmethod
def transcribe(
self,
audio: np.ndarray,
audio_sample_rate: int,
language: Optional[str] = None,
**kwargs,
) -> str:
pass
|