File size: 856 Bytes
93c5df6 | 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 | """Upload trained model to Hugging Face Hub."""
import os
from dotenv import load_dotenv
from huggingface_hub import HfApi, login
# Load environment variables
load_dotenv()
# Login with your token
print("🔐 Logging in to Hugging Face Hub...")
token = os.getenv("HF_TOKEN")
if not token:
raise ValueError("HF_TOKEN not found in .env file")
login(token=token)
print("✅ Login successful!")
# Upload model
print("📤 Uploading model to dpratapx/restaurant-inspector...")
api = HfApi()
api.create_repo(
repo_id="dpratapx/restaurant-inspector",
repo_type="model",
exist_ok=True,
private=False,
)
api.upload_folder(
folder_path="./model",
repo_id="dpratapx/restaurant-inspector",
repo_type="model",
)
print("✅ Model uploaded successfully!")
print("🔗 View at: https://huggingface.co/dpratapx/restaurant-inspector")
|