Deploying to Render (Free)¶
Render hosts a FastAPI service for free, but now requires a credit card even for the free option.
The service will sleep after inactivity and wake on the next request (cold start ~50s or more).
Free Option¶
Free instances spin down after periods of inactivity. They do not support SSH access, scaling, one-off jobs, or persistent disks. Select any paid instance type (starting at $7/month in June 2026) to enable these features.
Requirements¶
- An appropriate, working repository pushed to GitHub
- A free account at render.com
artifacts/model.joblibcommitted to your repo- run
model_builder_case.pylocally first if missing. - For a custom model output your model_yourname.joblib.
Update Configuration File¶
Update the render.yaml file in the root project folder.
- update repo
nameto your repo name - update
startCommandto use your custom app name
Steps¶
- Go to render.com and sign up with your GitHub account.
- Click New / Web Service.
- Connect your GitHub account if prompted, then select your repo.
- Render will detect
render.yamlautomatically and pre-fill the settings. - Confirm the settings look correct and click Deploy.
- Wait for the build to complete (2–4 minutes first time).
- Render gives you a public URL like
https://ml-penguin-predictor-xxxx.onrender.com.
Build Command:
Start Command (use your module name):
Testing Your Deployment¶
Replace YOUR-URL with your Render URL:
# PowerShell
curl -X POST https://YOUR-URL/predict `
-H "Content-Type: application/json" `
-d '{"bill_length_mm": 39.1, "bill_depth_mm": 18.7, "flipper_length_mm": 181, "body_mass_g": 3750}'
# macOS / Linux
curl -X POST https://YOUR-URL/predict \
-H "Content-Type: application/json" \
-d '{"bill_length_mm": 39.1, "bill_depth_mm": 18.7, "flipper_length_mm": 181, "body_mass_g": 3750}'
For example:
# PowerShell
curl -X POST https://ml-penguin-predictor.onrender.com/predict `
-H "Content-Type: application/json" `
-d '{"bill_length_mm": 39.1, "bill_depth_mm": 18.7, "flipper_length_mm": 181, "body_mass_g": 3750}'
# macOS / Linux
curl -X POST https://ml-penguin-predictor.onrender.com/predict \
-H "Content-Type: application/json" \
-d '{"bill_length_mm": 39.1, "bill_depth_mm": 18.7, "flipper_length_mm": 181, "body_mass_g": 3750}'
Should return:
The interactive API docs are also available at https://YOUR-URL/docs.
Notes¶
- Cold starts: The free tier sleeps after ~15 minutes of inactivity. The first request after sleeping takes ~30 seconds.
- Redeployment: Render redeploys automatically on every push to
main. - Logs: View live logs in the Render dashboard under your service → Logs.