|
|
|
|
|
|
|
|
|
|
|
Write-Host "`n" -ForegroundColor Green
|
|
|
Write-Host "=" * 70 -ForegroundColor Green
|
|
|
Write-Host "π CALIFORNIA HOUSE PRICE PREDICTION - HUGGING FACE DEPLOYMENT" -ForegroundColor Green
|
|
|
Write-Host "=" * 70 -ForegroundColor Green
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 1: Checking Hugging Face CLI..." -ForegroundColor Cyan
|
|
|
try {
|
|
|
$hfVersion = huggingface-cli --version 2>$null
|
|
|
Write-Host "β
Hugging Face CLI is installed: $hfVersion" -ForegroundColor Green
|
|
|
}
|
|
|
catch {
|
|
|
Write-Host "β Hugging Face CLI is not installed" -ForegroundColor Red
|
|
|
Write-Host "Installing Hugging Face CLI..." -ForegroundColor Yellow
|
|
|
pip install huggingface_hub
|
|
|
Write-Host "β
Hugging Face CLI installed" -ForegroundColor Green
|
|
|
}
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 2: Checking Hugging Face authentication..." -ForegroundColor Cyan
|
|
|
Write-Host "You need to be logged in to Hugging Face to deploy." -ForegroundColor Yellow
|
|
|
Write-Host "If you don't have an account, create one at https://huggingface.co/join" -ForegroundColor Yellow
|
|
|
Write-Host "`n"
|
|
|
|
|
|
$isAuthenticated = huggingface-cli whoami 2>$null
|
|
|
if (-not $isAuthenticated) {
|
|
|
Write-Host "You are not logged in. Starting login process..." -ForegroundColor Yellow
|
|
|
huggingface-cli login
|
|
|
$isAuthenticated = huggingface-cli whoami
|
|
|
}
|
|
|
|
|
|
if ($isAuthenticated) {
|
|
|
Write-Host "β
You are logged in as: $isAuthenticated" -ForegroundColor Green
|
|
|
}
|
|
|
else {
|
|
|
Write-Host "β Login failed. Cannot continue." -ForegroundColor Red
|
|
|
exit 1
|
|
|
}
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 3: Checking Git LFS..." -ForegroundColor Cyan
|
|
|
try {
|
|
|
$gitLfsVersion = git lfs version 2>$null
|
|
|
Write-Host "β
Git LFS is installed" -ForegroundColor Green
|
|
|
}
|
|
|
catch {
|
|
|
Write-Host "β Git LFS is not installed" -ForegroundColor Red
|
|
|
Write-Host "Please install Git LFS from: https://git-lfs.github.com/" -ForegroundColor Yellow
|
|
|
exit 1
|
|
|
}
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 4: Repository Configuration" -ForegroundColor Cyan
|
|
|
$repoName = "house-price-prediction"
|
|
|
Write-Host "Repository name: $repoName" -ForegroundColor White
|
|
|
|
|
|
|
|
|
$username = huggingface-cli whoami
|
|
|
$repoUrl = "https://huggingface.co/$username/$repoName"
|
|
|
Write-Host "Repository URL: $repoUrl" -ForegroundColor White
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 5: Setting up Git LFS..." -ForegroundColor Cyan
|
|
|
Write-Host "Initializing Git LFS for large model files..." -ForegroundColor White
|
|
|
git lfs install
|
|
|
git lfs track "*.joblib"
|
|
|
Write-Host "β
Git LFS configured" -ForegroundColor Green
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 6: Initializing Git Repository..." -ForegroundColor Cyan
|
|
|
if (-not (Test-Path ".git")) {
|
|
|
Write-Host "Initializing new git repository..." -ForegroundColor White
|
|
|
git init
|
|
|
git config user.name "House Price Predictor Bot"
|
|
|
git config user.email "[email protected]"
|
|
|
Write-Host "β
Git repository initialized" -ForegroundColor Green
|
|
|
}
|
|
|
else {
|
|
|
Write-Host "β
Git repository already initialized" -ForegroundColor Green
|
|
|
}
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 7: Staging files..." -ForegroundColor Cyan
|
|
|
Write-Host "Adding all files to git..." -ForegroundColor White
|
|
|
git add .
|
|
|
Write-Host "β
Files staged" -ForegroundColor Green
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "STEP 8: Committing changes..." -ForegroundColor Cyan
|
|
|
$commitMessage = "Initial commit: California House Price Prediction Model"
|
|
|
git commit -m $commitMessage --allow-empty
|
|
|
Write-Host "β
Changes committed" -ForegroundColor Green
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 9: Pushing to Hugging Face..." -ForegroundColor Cyan
|
|
|
|
|
|
|
|
|
git remote rm origin 2>$null
|
|
|
|
|
|
|
|
|
Write-Host "Adding remote: $repoUrl" -ForegroundColor White
|
|
|
git remote add origin $repoUrl
|
|
|
|
|
|
Write-Host "Pushing to Hugging Face (this may take a few minutes)..." -ForegroundColor White
|
|
|
Write-Host "Note: Large model files (41.4 MB) may take time to upload" -ForegroundColor Yellow
|
|
|
|
|
|
git push -u origin main --force
|
|
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
|
Write-Host "β
Push successful!" -ForegroundColor Green
|
|
|
}
|
|
|
else {
|
|
|
Write-Host "β οΈ Push completed with some warnings (this is usually okay)" -ForegroundColor Yellow
|
|
|
}
|
|
|
|
|
|
Write-Host "`n"
|
|
|
|
|
|
|
|
|
Write-Host "STEP 10: Verifying deployment..." -ForegroundColor Cyan
|
|
|
Write-Host "Your model is now being processed by Hugging Face..." -ForegroundColor White
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "=" * 70 -ForegroundColor Green
|
|
|
Write-Host "π DEPLOYMENT COMPLETE!" -ForegroundColor Green
|
|
|
Write-Host "=" * 70 -ForegroundColor Green
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "Your model has been successfully uploaded to Hugging Face!" -ForegroundColor Green
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "π Model URL: $repoUrl" -ForegroundColor Cyan
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "Next steps:" -ForegroundColor Yellow
|
|
|
Write-Host "1. Visit your model page: $repoUrl" -ForegroundColor White
|
|
|
Write-Host "2. Verify all files are present (README.md, *.joblib, etc.)" -ForegroundColor White
|
|
|
Write-Host "3. Add additional metadata on the web interface if desired" -ForegroundColor White
|
|
|
Write-Host "4. Share your model with the community!" -ForegroundColor White
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "Optional - Add model tags on Hugging Face web interface:" -ForegroundColor Yellow
|
|
|
Write-Host "- tabular-regression" -ForegroundColor White
|
|
|
Write-Host "- scikit-learn" -ForegroundColor White
|
|
|
Write-Host "- random-forest" -ForegroundColor White
|
|
|
Write-Host "- house-prices" -ForegroundColor White
|
|
|
Write-Host "- california-housing" -ForegroundColor White
|
|
|
Write-Host "`n"
|
|
|
|
|
|
Write-Host "π Learn more about your model card:" -ForegroundColor Cyan
|
|
|
Write-Host "https://huggingface.co/docs/hub/models-cards" -ForegroundColor White
|
|
|
Write-Host "`n"
|
|
|
|