refactor code, use package libraries for freqsplit/preprocessing/classify

- add additional params: sr=None and mono=False for freqsplit/input/file_reader/read_audio()
- remove loading audio using librosa in freqsplit/preprocessing/classify/classify_audio()
- add error handling, if the sr is not 16Khz
- raise RuntimeError, if YAMNet model fails
- update tests/test_preprocessing
This commit is contained in:
Joel Mathew Thomas
2025-02-25 20:06:49 +05:30
parent 825da48712
commit 3074084ac1
3 changed files with 21 additions and 12 deletions
+2 -1
View File
@@ -24,8 +24,9 @@ def test_trim_audio():
def test_classify():
file_path = "tests/test_audio/cafe_crowd_talk.wav"
waveform, sr = read_audio(file_path, 16000, mono=True)
expected_class = "Speech"
predicted_class = classify_audio(file_path)
predicted_class = classify_audio(waveform, sr)
assert predicted_class == expected_class , f"Expected {expected_class}, but got {predicted_class}"