File size: 2,444 Bytes
8eab354 | 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | """
Script to push InklyAI to Hugging Face Hub
"""
import os
from huggingface_hub import HfApi, create_repo, upload_folder
from pathlib import Path
def push_to_huggingface():
"""Push the InklyAI repository to Hugging Face Hub."""
# Initialize Hugging Face API
api = HfApi()
# Repository details
repo_id = "pravinai/InklyAI"
repo_type = "model"
print("π Pushing InklyAI to Hugging Face Hub...")
print(f"Repository: {repo_id}")
try:
# Create repository if it doesn't exist
print("π Creating repository...")
create_repo(
repo_id=repo_id,
repo_type=repo_type,
exist_ok=True,
private=False
)
print("β
Repository created successfully!")
# Upload the entire folder
print("π€ Uploading files...")
upload_folder(
folder_path=".",
repo_id=repo_id,
repo_type=repo_type,
ignore_patterns=[
"*.pyc",
"__pycache__",
".git",
".gitignore",
"*.log",
"logs/",
"uploads/",
"data/samples/",
"evaluation_results/",
"models/",
"*.pth",
"*.pt",
"*.bin",
"*.npy",
"*.json",
"tmp/",
"temp/"
]
)
print("β
Files uploaded successfully!")
# Upload model card
print("π Uploading model card...")
api.upload_file(
path_or_fileobj="model_card.md",
path_in_repo="README.md",
repo_id=repo_id,
repo_type=repo_type
)
print("β
Model card uploaded successfully!")
print(f"\nπ Successfully pushed to Hugging Face!")
print(f"π Repository URL: https://huggingface.co/{repo_id}")
except Exception as e:
print(f"β Error pushing to Hugging Face: {e}")
return False
return True
if __name__ == "__main__":
success = push_to_huggingface()
if success:
print("\nβ
InklyAI is now available on Hugging Face Hub!")
print("π You can access it at: https://huggingface.co/pravinai/InklyAI")
else:
print("\nβ Failed to push to Hugging Face Hub")
|