Web interface for ALLFED's integrated model
July 23, 2026 · View on GitHub
This repo contains a Streamlit web interface for ALLFED's integrated food system model. The app lets you configure a single-country scenario (nuclear winter, resilient foods, feed/biofuel shutoff, food stocks, etc.), runs the integrated model, and displays the resulting plots along with Excel/log downloads.
The previous Flask version of this interface (
app.py+templates/) is kept for reference but is no longer maintained. It required the now-deletedweb-interface-compatibilitybranch of the model; the Streamlit app works with the model's current code.
How it works
streamlit_app.py builds a scenario YAML from the UI inputs, runs
src/scenarios/run_scenarios_from_yaml.py from the model repo in a subprocess,
reads the result CSVs from the model's results/ directory, and renders the
plots with Plotly.
The integrated model lives in the allfed-integrated-model/ subdirectory. It is
registered as a git submodule, but the app will also clone it automatically at
startup if the directory is missing or empty (this is what happens on
Streamlit Community Cloud). The clone URL/branch can be overridden with the
MODEL_REPO_URL and MODEL_REPO_BRANCH secrets or environment variables
(default: the main branch of allfed/allfed-integrated-model).
Running locally
- Create and activate a virtual environment (Python 3.11 or 3.12):
python3 -m venv .venv && source .venv/bin/activate - Install the dependencies:
pip install -r requirements.txt - (Optional) Populate the model submodule yourself:
git submodule update --init— otherwise the app clones it on first run. - Run the app:
streamlit run streamlit_app.py
To enable the password gate locally, create .streamlit/secrets.toml with:
APP_PASSWORD = "your-password"
Deploying to Streamlit Community Cloud
-
Push this repo to GitHub.
-
On share.streamlit.io, create a new app from the repo, with
streamlit_app.pyas the main file (pick Python 3.11 or 3.12 in the advanced settings). -
In the app's Settings → Secrets, add:
APP_PASSWORD = "your-password"Leave
APP_PASSWORDout to make the app public.MODEL_REPO_URL/MODEL_REPO_BRANCHcan also be set there to point the app at a different model fork or branch.
Repo orientation
streamlit_app.py— the Streamlit appallfed-integrated-model/— the integrated model (submodule / runtime clone)app.py,templates/— the legacy Flask interface (deprecated)