Download scripts/subir_hf.py from Changetheblock/LicitaBench: direct link, hf CLI and curl.
- Browser
- Download file 1.92 kB
-
https://huggingface.co/datasets/Changetheblock/LicitaBench/resolve/main/scripts/subir_hf.py
- Command line
-
hf download hf://datasets/Changetheblock/LicitaBench/scripts/subir_hf.py
-
curl -L -o subir_hf.py https://huggingface.co/datasets/Changetheblock/LicitaBench/resolve/main/scripts/subir_hf.py
1.92 kB
| """Sube la copia de publicación (sh scripts/preparar_publicacion.sh) a Hugging Face como | |
| repositorio de dataset. Usa la sesión guardada con `hf auth login`: este script nunca pide | |
| ni lee tokens. Añade al README la cabecera de metadatos que Hugging Face necesita para la | |
| ficha del dataset; el README del repositorio de trabajo no la lleva. | |
| .venv/bin/python scripts/subir_hf.py ../licitabench-publicar Changetheblock/LicitaBench | |
| """ | |
| import shutil | |
| import sys | |
| import tempfile | |
| from pathlib import Path | |
| CABECERA = """--- | |
| license: cc-by-4.0 | |
| language: | |
| - es | |
| - ca | |
| - eu | |
| - gl | |
| pretty_name: LicitaBench | |
| size_categories: | |
| - 1K<n<10K | |
| task_categories: | |
| - question-answering | |
| - text-classification | |
| tags: | |
| - public-procurement | |
| - contratacion-publica | |
| - placsp | |
| - spanish | |
| - legal | |
| - benchmark | |
| configs: | |
| - config_name: t1 | |
| data_files: data/dataset/t1.jsonl | |
| --- | |
| """ | |
| def main(argv) -> int: | |
| if len(argv) < 2: | |
| print(__doc__); return 2 | |
| copia, repo = Path(argv[0]).resolve(), argv[1] | |
| from huggingface_hub import HfApi | |
| api = HfApi() | |
| quien = api.whoami() | |
| print(f"Sesión de Hugging Face: {quien.get('name')} (organizaciones: {', '.join(o['name'] for o in quien.get('orgs', []))})") | |
| with tempfile.TemporaryDirectory() as tmp: | |
| dest = Path(tmp) / "repo" | |
| shutil.copytree(copia, dest, ignore=shutil.ignore_patterns(".git")) | |
| readme = dest / "README.md" | |
| readme.write_text(CABECERA + readme.read_text(encoding="utf-8"), encoding="utf-8") | |
| api.create_repo(repo, repo_type="dataset", exist_ok=True, private=False) | |
| info = api.upload_folder(folder_path=str(dest), repo_id=repo, repo_type="dataset", | |
| commit_message="LicitaBench v0.1: benchmark de lectura de pliegos de contratación pública") | |
| print(f"Subido: https://huggingface.co/datasets/{repo}\n{info}") | |
| return 0 | |
| if __name__ == "__main__": | |
| sys.exit(main(sys.argv[1:])) | |