Download data_registration.py from RahulSingh211/TourismPackagePrediction: direct link, hf CLI and curl.
- Browser
- Download file 722 Bytes
-
https://huggingface.co/datasets/RahulSingh211/TourismPackagePrediction/resolve/main/data_registration.py
- Command line
-
hf download hf://datasets/RahulSingh211/TourismPackagePrediction/data_registration.py
-
curl -L -o data_registration.py https://huggingface.co/datasets/RahulSingh211/TourismPackagePrediction/resolve/main/data_registration.py
722 Bytes
| from huggingface_hub.utils import RepositoryNotFoundError, HfHubHTTPError | |
| from datasets import load_dataset, Dataset | |
| from huggingface_hub import HfApi | |
| import os | |
| # Initialize HuggingFace API | |
| api = HfApi(token=os.getenv("HF_TOKEN")) | |
| # Define repository details | |
| repo_id = "RahulSingh211/tourism_dataset" | |
| repo_type = "dataset" | |
| # Create repository if it doesn't exist | |
| api.create_repo( | |
| repo_id=repo_id, | |
| repo_type=repo_type, | |
| private=False, | |
| exist_ok=True | |
| ) | |
| print(f"Repository '{repo_id}' is ready.") | |
| # Upload the tourism.csv file to the repository | |
| print("Uploading tourism.csv to Hugging Face Hub...") | |
| api.upload_folder( | |
| folder_path="tourism_project/data", | |
| repo_id=repo_id, | |
| repo_type=repo_type | |
| ) | |