Spaces:
Running
Running
File size: 721 Bytes
a602628 6c32e21 | 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 typing import List
from .models import AudioSample, DatasetMetadata
class CoreMixin:
"""Base state for dataset builder."""
def __init__(self):
self.samples: List[AudioSample] = []
self.metadata = DatasetMetadata()
self._current_dir: str = ""
def get_sample_count(self) -> int:
"""Get the number of samples in the dataset."""
return len(self.samples)
def get_labeled_count(self) -> int:
"""Get the number of labeled samples."""
return sum(1 for s in self.samples if s.labeled)
def get_preprocessed_count(self) -> int:
"""Get the number of preprocessed samples."""
return sum(1 for s in self.samples if s.preprocessed)
|