Spaces:
Runtime error
Runtime error
Download utils.py from zinoubm/ClientTest: direct link, hf CLI and curl.
- Browser
- Download file 593 Bytes
-
https://huggingface.co/spaces/zinoubm/ClientTest/resolve/main/utils.py
- Command line
-
hf download hf://spaces/zinoubm/ClientTest/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/zinoubm/ClientTest/resolve/main/utils.py
593 Bytes
| import librosa | |
| import soundfile as sf | |
| def compress(audio_file): | |
| y, s = librosa.load(audio_file, sr=8000) # Downsample 44.1kHz to 8kHz | |
| sf.write(audio_file, y, s, "PCM_24") | |
| return audio_file | |
| # Define a helper function to convert credentials to dictionary | |
| def credentials_to_dict(credentials): | |
| return { | |
| "token": credentials.token, | |
| "refresh_token": credentials.refresh_token, | |
| "token_uri": credentials.token_uri, | |
| "client_id": credentials.client_id, | |
| "client_secret": credentials.client_secret, | |
| "scopes": credentials.scopes, | |
| } | |