restaurant-inspector-api-dev / upload_model.py
dpratapx's picture
Add Streamlit admin dashboard and normalize database with restaurants table
93c5df6
Raw
History Blame Contribute Delete
856 Bytes
"""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")