Spaces:
Configuration error
Configuration error
Download utils.py from KayodeAkanni/AfriNews_Cluster: direct link, hf CLI and curl.
- Browser
- Download file 871 Bytes
-
https://huggingface.co/spaces/KayodeAkanni/AfriNews_Cluster/resolve/main/utils.py
- Command line
-
hf download hf://spaces/KayodeAkanni/AfriNews_Cluster/utils.py
-
curl -L -o utils.py https://huggingface.co/spaces/KayodeAkanni/AfriNews_Cluster/resolve/main/utils.py
871 Bytes
| from datasets import load_dataset_builder, load_dataset | |
| import logging | |
| def inspect(): | |
| langs = ['amharic','english','hausa','swahili','yoruba','igbo'] | |
| for lang in langs: | |
| ds_builder = load_dataset_builder("csebuetnlp/xlsum",lang) | |
| desc = ds_builder.info.description | |
| feat = ds_builder.info.features | |
| return desc,feat | |
| def load(): | |
| try: | |
| langs = ['amharic','hausa','swahili','yoruba','igbo'] | |
| for lang in langs: | |
| dataset = load_dataset("csebuetnlp/xlsum", lang ,split="train") | |
| #for split, data in dataset.items(): | |
| dataset.to_csv(f"{lang}.csv", index = None) | |
| #dataset.save_to_disk(lang) | |
| #return dataset | |
| except Exception as ex: | |
| logging.debug(ex) | |
| if __name__ == '__main__': | |
| #print(inspect()) | |
| load() |