import os from huggingface_hub import HfApi def deploy(): # 1. Get your Hugging Face Token from https://huggingface.co/settings/tokens # 2. Get your Space ID (e.g. "username/manifesto-explainer") token = input("Enter your Hugging Face Write Token: ").strip() repo_id = input("Enter your Space Repository ID (e.g., your-username/manifesto-explainer): ").strip() if not token or not repo_id: print("Error: Token and Repo ID are required.") return api = HfApi() print(f"šŸš€ Uploading project to Hugging Face Space: {repo_id}...") try: # This will upload the entire current directory to the Space # It respects .gitignore and .dockerignore api.upload_folder( folder_path=".", repo_id=repo_id, repo_type="space", token=token, ignore_patterns=["*.env", "__pycache__/*", "venv/*", ".git/*"] ) print("\nāœ… Success! Your files have been uploaded.") print(f"šŸ”— View your Space here: https://huggingface.co/spaces/{repo_id}") print("\nāš ļø IMPORTANT: Don't forget to go to Space Settings > Variables and secrets") print("and add your GROQ_API_KEY and GEMINI_API_KEY as Secrets.") except Exception as e: print(f"\nāŒ Error during upload: {e}") if __name__ == "__main__": deploy()