Spaces:
Build error
Build error
Download Script.py from ChristianSardo/QAAI_API: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/ChristianSardo/QAAI_API/resolve/main/Script.py
- Command line
-
hf download hf://spaces/ChristianSardo/QAAI_API/Script.py
-
curl -L -o Script.py https://huggingface.co/spaces/ChristianSardo/QAAI_API/resolve/main/Script.py
1.07 kB
| from huggingface_hub import HfApi, create_repo, upload_file | |
| # ------------------------------------------- | |
| # CONFIGURAÇÕES | |
| # ------------------------------------------- | |
| REPO_NAME = "ChristianSardo/bimboca-dataset" # Ex: christian-sardo/bimboca-dataset | |
| LOCAL_FILE_PATH = r"C:\Users\christian_sardo\Documents\ra\bimboca.csv" | |
| REMOTE_PATH = "bimboca.csv" # Nome do arquivo no hub | |
| # ------------------------------------------- | |
| # EXECUÇÃO | |
| # ------------------------------------------- | |
| api = HfApi() | |
| # Criar repo se não existir | |
| try: | |
| create_repo(repo_id=REPO_NAME, token=HF_TOKEN, repo_type="dataset") | |
| print(f"Repositório criado: https://huggingface.co/datasets/{REPO_NAME}") | |
| except Exception as e: | |
| print(f"Repo já existe ou outro aviso: {e}") | |
| # Upload do arquivo | |
| upload_file( | |
| token=HF_TOKEN, | |
| path_or_fileobj=LOCAL_FILE_PATH, | |
| repo_id=REPO_NAME, | |
| repo_type="dataset", | |
| path_in_repo=REMOTE_PATH | |
| ) | |
| print("Upload completo!") | |
| print(f"Dataset disponível em: https://huggingface.co/datasets/{REPO_NAME}") | |