Fixed code to support Python3.9 syntax

This commit is contained in:
Kavi 2025-02-27 13:51:58 +01:00
parent 230b6167bc
commit 54ca555587
3 changed files with 4 additions and 4 deletions

View File

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

View File

@ -185,7 +185,7 @@ def load_audio_data(
target_samp_rate: int,
scale: bool = False,
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.
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,
config: ProcessingConfiguration,
device: torch.device,
file_id: str | None = None
file_id: Optional[str] = None
) -> Union[RunResults, Any]:
"""Process a single audio file with detection model.