card2 / upload_to_hf.py
d-e-e-k-11's picture
Upload folder using huggingface_hub
08d6be3 verified
from huggingface_hub import HfApi
import os
api = HfApi()
repo_id = "d-e-e-k-11/credit-card-fraud-detection"
local_folder = "c:/card"
print(f"Uploading files from {local_folder} to {repo_id}...")
# Files to ignore
ignore_patterns = [
".git*",
"eda.py",
"train_model.py",
"task.md",
"implementation_plan.md",
"create_hf_space.py",
"upload_to_hf.py",
"class_distribution.png",
"distributions.png",
"scaler.joblib", # Old scaler file
"__pycache__",
".gemini*"
]
try:
api.upload_folder(
repo_id=repo_id,
folder_path=local_folder,
repo_type="space",
ignore_patterns=ignore_patterns
)
print("Upload complete!")
print(f"Your space is live at: https://huggingface.co/spaces/{repo_id}")
except Exception as e:
print(f"Error uploading files: {e}")