Download test_split.py from TREA-ORCA/TREA_2.0_codebase: direct link, hf CLI and curl.
- Browser
- Download file 558 Bytes
-
https://huggingface.co/TREA-ORCA/TREA_2.0_codebase/resolve/main/test_split.py
- Command line
-
hf download hf://TREA-ORCA/TREA_2.0_codebase/test_split.py
-
curl -L -o test_split.py https://huggingface.co/TREA-ORCA/TREA_2.0_codebase/resolve/main/test_split.py
558 Bytes
| import pandas as pd | |
| from pydub import AudioSegment | |
| from pydub.silence import split_on_silence | |
| from pydub.silence import detect_nonsilent | |
| df = pd.read_csv('/home/debarpanb1/TREA_2.0/pipeline/dataset_v5/multi_hop/multi_hop_metadata.csv') | |
| for idx, row in df.head(1).iterrows(): | |
| audio = AudioSegment.from_wav('/home/debarpanb1/TREA_2.0/pipeline/dataset_v5/' + row['audio_path']) | |
| nonsilent = detect_nonsilent(audio, min_silence_len=300, silence_thresh=audio.dBFS-16) | |
| print("Nonsilent regions:", nonsilent) | |
| print("Categories:", row['categories']) | |