File size: 1,028 Bytes
eb7ccc0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | get_ipython().getoutput("pip install -q huggingface_hub")
from huggingface_hub import login
from kaggle_secrets import UserSecretsClient
# "HF_TOKEN" here is the LABEL you set in Add-ons -> Secrets, not the token itself
hf_token = UserSecretsClient().get_secret("HF_TOKEN")
login(token=hf_token)
get_ipython().getoutput("kaggle kernels output mickey2004/complete-fakeddit-image -p "/kaggle/working/"")
from huggingface_hub import HfApi, create_repo
repo_id = "jayesh20/ai-image-detector" # change this
api = HfApi()
# Create the repo (safe to call even if it already exists)
create_repo(repo_id, repo_type="model", exist_ok=True, private=False)
# Upload a single checkpoint file
api.upload_file(
path_or_fileobj="/kaggle/working/best_clip_detector.pth",
path_in_repo="best_clip_detector.pth",
repo_id=repo_id,
repo_type="model",
)
api.upload_folder(
folder_path="/kaggle/working/",
repo_id=repo_id,
repo_type="model",
path_in_repo=".", # or "stage1/" to keep it in a subfolder
)
|