Spaces:
Sleeping
Sleeping
π Free Cloud Deployment for Hackathon
Quick Deploy Options (FREE)
1. Railway.app (RECOMMENDED) β
Why Railway: No credit card, easy GitHub integration, fast deployment
Steps:
Push to GitHub:
git add . git commit -m "Ready for deployment" git push origin feature/api-integrationDeploy on Railway:
- Go to https://railway.app
- Click "Deploy from GitHub repo"
- Select your repository
- Railway auto-detects Dockerfile
- Deploy takes 2-3 minutes
Your friend gets URL:
https://your-project.railway.app/predict
2. Render.com (Alternative)
Steps:
- Create account at https://render.com
- Connect GitHub repo
- Choose "Web Service"
- Auto-deploys from Dockerfile
URL format: https://your-app.onrender.com/predict
3. Fly.io (For Performance)
Steps:
# Install fly CLI
curl -L https://fly.io/install.sh | sh
# Login and deploy
flyctl launch
flyctl deploy
π― INSTANT TESTING (No Deployment Needed)
Option A: ngrok (Fastest for hackathon demo)
# Terminal 1: Start API
uvicorn test_api:app --host 0.0.0.0 --port 8002
# Terminal 2: Create tunnel
# Download from: https://ngrok.com/download
./ngrok http 8002
# Share the https URL with your friend!
# Example: https://abc123.ngrok.io/predict
Option B: LocalTunnel
# Install
npm install -g localtunnel
# Start API
uvicorn test_api:app --host 0.0.0.0 --port 8002
# Create tunnel
lt --port 8002 --subdomain your-crop-api
# URL: https://your-crop-api.loca.lt/predict
π± For Your Friend to Test
Sample curl command:
curl -X POST "https://YOUR-DEPLOYED-URL/predict" \
-H "Content-Type: application/json" \
-d '{
"year": 2024,
"state": "Punjab",
"crop": "Rice",
"season": "Kharif",
"area": 10.0,
"production": 25.0,
"rainfall": 1200,
"fertilizer": 75,
"pesticide": 8
}'
Sample Python code:
import requests
url = "https://YOUR-DEPLOYED-URL/predict"
data = {
"year": 2024,
"state": "Punjab",
"crop": "Rice",
"season": "Kharif",
"area": 10.0,
"production": 25.0,
"rainfall": 1200,
"fertilizer": 75,
"pesticide": 8
}
response = requests.post(url, json=data)
print(response.json())
π Recommended for Hackathon Demo
FASTEST OPTION: Use ngrok for immediate sharing BEST OPTION: Deploy to Railway.app for permanent URL
Both are completely FREE and perfect for hackathons! π