|
|
""" |
|
|
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.""" |
|
|
|
|
|
|
|
|
api = HfApi() |
|
|
|
|
|
|
|
|
repo_id = "pravinai/InklyAI" |
|
|
repo_type = "model" |
|
|
|
|
|
print("π Pushing InklyAI to Hugging Face Hub...") |
|
|
print(f"Repository: {repo_id}") |
|
|
|
|
|
try: |
|
|
|
|
|
print("π Creating repository...") |
|
|
create_repo( |
|
|
repo_id=repo_id, |
|
|
repo_type=repo_type, |
|
|
exist_ok=True, |
|
|
private=False |
|
|
) |
|
|
print("β
Repository created successfully!") |
|
|
|
|
|
|
|
|
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!") |
|
|
|
|
|
|
|
|
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") |
|
|
|