ag_forecasting_api is a FastAPI application that provides crop disease forecasting models for corn and soybean in Wisconsin, developed by University of Wisconsin-Madison plant pathology experts.
Initialize a worker with the min image:
./ol worker init -i ol-minEdit myworker/config.json to increase memory limit (512MB needed for this app):
"limits": {
"mem_mb": 512,
...
}Start the worker:
./ol worker up -dCreate ol.yaml to configure the app for OpenLambda:
triggers:
http:
- method: "*"
environment:
OL_ENTRY_FILE: app.py
OL_ASGI_ENTRY: app
MEASUREMENTS_CACHE_DIR: /host/tmp/cache
STATIONS_CACHE_FILE: /host/tmp/cache/wisconsin_stations_cache.csvInstall pip-compile and pin requirements.txt to versions suitable for OpenLambda:
./ol admin install examples/pip-compile
curl -X POST -d 'https://raw.githubusercontent.com/tylerharter/ag_forecasting_api/main/requirements.txt' http://localhost:5000/run/pip-compile/url > requirements.txtInstall and test:
./ol admin install -c ol.yaml -r requirements.txt https://github.com/tylerharter/ag_forecasting_api.git
# simple test
curl http://localhost:5000/run/ag_forecasting_api/
# get a forecast for the ALTN station
curl "http://localhost:5000/run/ag_forecasting_api/ag_models_wrappers/wisconet?forecasting_date=2024-07-01&risk_days=1&station_id=ALTN"Note, the first request may take minutes because OpenLambda will install all the packages in requirements.txt upon the first call.
TODO: update ag_forecasting_api URLs from tylerharter fork to UW-Madison-DSI once env option is merged upstream.
