#!/usr/bin/env python3 """ Script to upload HarpoonNet 1.2 model to Hugging Face Hub """ import os from huggingface_hub import HfApi, login import getpass def upload_model(): """Upload the model to Hugging Face Hub""" # Get token from user print("šŸ” Please enter your Hugging Face token:") print(" (Get it from: https://huggingface.co/settings/tokens)") token = getpass.getpass("Token: ") # Login to Hugging Face try: login(token=token) print("āœ… Successfully logged in to Hugging Face!") except Exception as e: print(f"āŒ Login failed: {e}") return False # Initialize the API api = HfApi() # Repository details repo_id = "christiankhoury05/harpoon-1-2" try: print(f"šŸš€ Uploading model to {repo_id}...") # Upload all files in the current directory api.upload_folder( folder_path=".", repo_id=repo_id, repo_type="model", commit_message="HarpoonNet 1.2 - ConvNeXt-Small Architecture (~50M params) - Fixed Model Upload" ) print("āœ… Model uploaded successfully!") print(f"🌐 View your model at: https://huggingface.co/{repo_id}") return True except Exception as e: print(f"āŒ Upload failed: {e}") return False if __name__ == "__main__": print("šŸŽÆ HarpoonNet 1.2 - Hugging Face Upload Script") print("=" * 50) # Check if we're in the right directory if not os.path.exists("pytorch_model.pth"): print("āŒ Error: pytorch_model.pth not found in current directory") print(" Please run this script from the hf_upload directory") exit(1) # Upload the model success = upload_model() if success: print("\nšŸŽ‰ Upload completed successfully!") print("Your HarpoonNet 1.2 model with non-commercial license is now available on Hugging Face!") print("šŸ“„ Users will see the licensing requirements clearly in the README") print("šŸ“§ Commercial inquiries will be directed to: christian@chiliadresearch.com") else: print("\nāŒ Upload failed. Please check your token and try again.")