File size: 1,624 Bytes
041a776
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Deploy Sasya AI to Neel2601/farmer-ai-backend (CPU basic Docker Space)
# Usage: powershell -ExecutionPolicy Bypass -File scripts\deploy_farmer_ai.ps1

$ErrorActionPreference = "Stop"
$ROOT = $PSScriptRoot | Split-Path -Parent
Set-Location $ROOT

$SpaceUrl = "https://huggingface.co/spaces/Neel2601/farmer-ai-backend"
$ApiUrl = "https://neel2601-farmer-ai-backend.hf.space"

Write-Host "=== Deploy Sasya AI -> farmer-ai-backend ===" -ForegroundColor Cyan
Write-Host "Space: $SpaceUrl"
Write-Host "API:   $ApiUrl/docs"

hf auth whoami 2>$null
if ($LASTEXITCODE -ne 0) { hf auth login }

& "D:\AI-ML\envs\agriforge-backend\Scripts\python.exe" scripts\upload_disease_model.py

if (-not (Test-Path ".git")) { git init }
git lfs install
git lfs track "trained_models/agricultural_tinyllama/agricultural_kb.json"

git add .gitignore .gitattributes README.md requirements.txt Dockerfile
git add space.py gradio_ui.py app/
git add trained_models/disease_detection/classes.json
git add trained_models/agricultural_tinyllama/agricultural_kb.json

$remote = $null
try { $remote = git remote get-url origin 2>$null } catch { $remote = $null }
if ($remote) { git remote set-url origin $SpaceUrl } else { git remote add origin $SpaceUrl }

git add -A
git commit -m "Sasya AI: replace farmer-ai-backend with 4-model API + Gradio UI" 2>$null

Write-Host "`nForce pushing to farmer-ai-backend..." -ForegroundColor Yellow
git branch -M main
git push -u origin main --force

Write-Host "`nDone! Wait 10-20 min for Docker build." -ForegroundColor Green
Write-Host "Health: curl $ApiUrl/health"
Write-Host "Expo:   EXPO_PUBLIC_API_URL=$ApiUrl"