A newer version of the Gradio SDK is available:
6.2.0
metadata
title: Upfront_Embodied_Carbon_Calculator
emoji: 📚
colorFrom: purple
colorTo: gray
sdk: gradio
sdk_version: 5.47.2
app_file: app.py
pinned: false
A1–A5 Upfront Embodied Carbon Calculator (Gradio)
A single-page Gradio app to compute A1–A5 upfront embodied carbon for building materials and processes. Enter rows of data (materials, transport, site energy/waste), get per-row results, per-module summary, total tCO2e, and optional reduction suggestions powered by a small LLM via Hugging Face Inference API.
Features
- Deterministic A1–A5 backend (EN 15978 scope; RICS/IStructE/GHG Protocol units)
- Units and aliases:
- A1–A3/A5 materials/waste:
kg|t×kgCO2e/kgortCO2e/t - A4 transport:
ton_km×kgCO2e/ton_km(aliases:t-km,t·km,ton-km) - A5 site energy:
kWh×kgCO2e/kWh
- A1–A3/A5 materials/waste:
- Output: per-row
kgCO2e|tCO2e, per-module summary,Total - Optional suggestions via Hugging Face Inference API (falls back to deterministic tips if no token)
Run locally
pip install -r requirements.txt
python app.py
Open the local URL printed by Gradio.
Deploy to Hugging Face Spaces
- Create a new Space (Gradio Python)
- Upload these files:
app.pyrequirements.txtREADME.md(optional)
- In Space Settings → Secrets, set one of the following if you want LLM suggestions:
HUGGINGFACEHUB_API_TOKEN(recommended), orHF_API_TOKEN
If no token is set, the app still runs and shows rule-based fallback suggestions.
Data columns (required)
module,name,quantity,unit,ef,ef_unit,notes
Examples:
- Concrete (A1):
10000 kg × 0.12 kgCO2e/kg - Rebar (A1):
2000 kg → 2 t × 1.9 tCO2e/t - CLT (A3):
5 t × 0.35 tCO2e/t - Truck transport (A4):
800 ton_km × 0.1 kgCO2e/ton_km - Construction waste (A5):
2 t × 0.25 tCO2e/t
Notes
- Backend validates missing columns, unsupported modules, and unit mismatches with clear errors
- Transport aliases are normalized to
ton_km - Keep provenance in
notes(EPD/database/assumptions) for auditability
License
MIT (user content and EPD/IP remain their respective owners)