Spaces:
Running
on
Zero
Running
on
Zero
File size: 559 Bytes
a602628 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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)
|