Spaces:
Sleeping
Sleeping
Download src/extractor.py from AmirFARES/accentometer: direct link, hf CLI and curl.
- Browser
- Download file 314 Bytes
-
https://huggingface.co/spaces/AmirFARES/accentometer/resolve/main/src/extractor.py
- Command line
-
hf download hf://spaces/AmirFARES/accentometer/src/extractor.py
-
curl -L -o extractor.py https://huggingface.co/spaces/AmirFARES/accentometer/resolve/main/src/extractor.py
314 Bytes
| from moviepy import VideoFileClip | |
| def extract_audio(video_path: str, output_path: str = "audio.wav") -> str: | |
| # Force output path to be in /tmp | |
| output_path = f"/tmp/{output_path}" | |
| video = VideoFileClip(video_path) | |
| video.audio.write_audiofile(output_path, codec="pcm_s16le") | |
| return output_path | |