Spaces:
Paused
Paused
Download utils/postprocess.py from Gae8J/gaepago_model: direct link, hf CLI and curl.
- Browser
- Download file 516 Bytes
-
https://huggingface.co/spaces/Gae8J/gaepago_model/resolve/main/utils/postprocess.py
- Command line
-
hf download hf://spaces/Gae8J/gaepago_model/utils/postprocess.py
-
curl -L -o postprocess.py https://huggingface.co/spaces/Gae8J/gaepago_model/resolve/main/utils/postprocess.py
516 Bytes
| import random | |
| def text_mapping(model_output,text_label): | |
| text_list = text_label[model_output] | |
| text,sent = random.sample(text_list,1)[0] | |
| return {'label' : model_output, | |
| 'text' : text, | |
| 'sentiment' : sent} | |
| def text_encoding(output): | |
| return {'label' : output['label'].encode(encoding='UTF-8', errors='strict'), | |
| 'text' : output['text'].encode(encoding='UTF-8', errors='strict'), | |
| 'sentiment' : output['sentiment'].encode(encoding='UTF-8', errors='strict')} |