Compare commits

...

2 Commits

Author SHA1 Message Date
Kavi Askholm Mellerup
db6f2b3fe8
Merge 54ca555587 into 2100a3e483 2025-02-27 12:54:54 +00:00
Kavi
54ca555587 Fixed code to support Python3.9 syntax 2025-02-27 13:51:58 +01:00
3 changed files with 4 additions and 4 deletions

View File

@ -250,7 +250,7 @@ def process_file(
model: DetectionModel = MODEL, model: DetectionModel = MODEL,
config: Optional[ProcessingConfiguration] = None, config: Optional[ProcessingConfiguration] = None,
device: torch.device = DEVICE, device: torch.device = DEVICE,
file_id: str | None = None file_id: Optional[str] = None
) -> du.RunResults: ) -> du.RunResults:
"""Process audio file with model. """Process audio file with model.
@ -286,7 +286,7 @@ def process_url(
model: DetectionModel = MODEL, model: DetectionModel = MODEL,
config: Optional[ProcessingConfiguration] = None, config: Optional[ProcessingConfiguration] = None,
device: torch.device = DEVICE, device: torch.device = DEVICE,
file_id: str | None = None file_id: Optional[str] = None
) -> du.RunResults: ) -> du.RunResults:
"""Process audio file with model. """Process audio file with model.

View File

@ -185,7 +185,7 @@ def load_audio_data(
target_samp_rate: int, target_samp_rate: int,
scale: bool = False, scale: bool = False,
max_duration: Optional[float] = None, max_duration: Optional[float] = None,
) -> Tuple[int, np.ndarray, int | float]: ) -> Tuple[int, np.ndarray, Union[float, int]]:
"""Load an audio file and resample it to the target sampling rate. """Load an audio file and resample it to the target sampling rate.
The audio is also scaled to [-1, 1] and clipped to the maximum duration. The audio is also scaled to [-1, 1] and clipped to the maximum duration.

View File

@ -742,7 +742,7 @@ def process_file(
model: DetectionModel, model: DetectionModel,
config: ProcessingConfiguration, config: ProcessingConfiguration,
device: torch.device, device: torch.device,
file_id: str | None = None file_id: Optional[str] = None
) -> Union[RunResults, Any]: ) -> Union[RunResults, Any]:
"""Process a single audio file with detection model. """Process a single audio file with detection model.