Spaces:
Build error
Build error
Download text_to_speech/utils/text/encoding.py from Datasculptor/AudioGPT: direct link, hf CLI and curl.
- Browser
- Download file 207 Bytes
-
https://huggingface.co/spaces/Datasculptor/AudioGPT/resolve/main/text_to_speech/utils/text/encoding.py
- Command line
-
hf download hf://spaces/Datasculptor/AudioGPT/text_to_speech/utils/text/encoding.py
-
curl -L -o encoding.py https://huggingface.co/spaces/Datasculptor/AudioGPT/resolve/main/text_to_speech/utils/text/encoding.py
207 Bytes
| import chardet | |
| def get_encoding(file): | |
| with open(file, 'rb') as f: | |
| encoding = chardet.detect(f.read())['encoding'] | |
| if encoding == 'GB2312': | |
| encoding = 'GB18030' | |
| return encoding | |