Spaces:
Running
Running
File size: 14,883 Bytes
8ba57d6 651bc0e 8ba57d6 3407867 8ba57d6 afb3711 89e980a afb3711 89e980a fc818a1 afb3711 e4b0981 afb3711 728b9e0 afb3711 728b9e0 afb3711 728b9e0 afb3711 2a816f9 afb3711 8ba57d6 afb3711 fc818a1 afb3711 8ba57d6 fc818a1 afb3711 8ba57d6 afb3711 8ba57d6 afb3711 8ba57d6 afb3711 8ba57d6 afb3711 8ba57d6 3dda7b6 afb3711 3dda7b6 8ba57d6 6bf06e3 afb3711 6bf06e3 afb3711 d453c25 c146a27 46be526 c146a27 8ba57d6 4e53fa2 c9c3a3c 8ba57d6 d89c2d2 89e980a 09a999f 89e980a 3dda7b6 89e980a d453c25 3dda7b6 d453c25 6bf06e3 d453c25 3dda7b6 afb3711 d453c25 728b9e0 09a999f a535b5b 09a999f a535b5b 09a999f 6bf06e3 d453c25 fc818a1 d453c25 6bf06e3 d453c25 afb3711 6bf06e3 d453c25 6bf06e3 728b9e0 db31180 6bf06e3 fc818a1 2fbfbbf 3b62159 2fbfbbf 3b62159 2c87879 6bf06e3 dfec70b 89e980a 2c87879 6bf06e3 d453c25 6bf06e3 d453c25 afb3711 6bf06e3 d453c25 6bf06e3 728b9e0 6bf06e3 dfec70b 6bf06e3 f1de9eb a535b5b 89e980a f1de9eb 6bf06e3 d453c25 6bf06e3 a535b5b d453c25 8ba57d6 d453c25 6bf06e3 d453c25 8ba57d6 d453c25 8ba57d6 4e53fa2 d453c25 8ba57d6 4e53fa2 8ba57d6 6bf06e3 d453c25 8ba57d6 1cbd801 8ba57d6 afb3711 6bf06e3 d453c25 8ba57d6 a346b83 f35560e a535b5b d453c25 f35560e d453c25 2c87879 f1de9eb 2c87879 d453c25 f35560e a346b83 2c87879 d453c25 f1de9eb d453c25 c9c3a3c f35560e c9c3a3c 2c87879 d30f60c a346b83 4523dba e26a2c1 034f8f2 c9c3a3c f35560e c9c3a3c d453c25 c9c3a3c e26a2c1 d453c25 8ba57d6 09a999f d453c25 e15019b a535b5b a346b83 f1de9eb a535b5b e15019b f1de9eb a535b5b f1de9eb e15019b f1de9eb d30f60c 92a5b3a e15019b d453c25 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 | import streamlit as st
import pandas as pd
import numpy as np
import plotly.graph_objects as go
# --- Page Configuration ---
st.set_page_config(
page_title="US AI Emissions in 2030",
page_icon="⚡",
layout="wide"
)
# --- Custom CSS ---
st.markdown("""
<style>
/* --- 1. Global Font Reset --- */
/* Applies a clean, modern system font to the whole app */
html, body, [class*="css"] {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol" !important;
}
/* --- 2. Sidebar Layout & Width --- */
[data-testid="stSidebar"] {
width: 450px !important;
min-width: 450px !important;
}
/* --- 3. Sidebar Typography --- */
/* Target the text inside the sidebar's markdown container */
[data-testid="stSidebarContent"] .stMarkdown {
color: white !important;
}
/* Optional: Target specific headers or paragraphs in the sidebar for clarity */
[data-testid="stSidebarContent"] p,
[data-testid="stSidebarContent"] h1,
[data-testid="stSidebarContent"] h2,
[data-testid="stSidebarContent"] h3 {
color: white !important;
}
/* The Custom Question Headers */
.sidebar-question {
font-size: 1.4rem;
font-weight: 700;
/* Use 'inherit' so Streamlit handles the Light/Dark color shift automatically */
color: inherit;
margin-bottom: 8px;
line-height: 1.3;
}
/* Standard Streamlit Labels (e.g., above sliders if visible) */
[data-testid="stSidebar"] label {
font-size: 1.1rem !important;
font-weight: 600 !important;
}
/* Markdown Paragraphs in Sidebar (e.g., in Expanders) */
[data-testid="stSidebar"] .stMarkdown p {
font-size: 1.05rem !important;
line-height: 1.5;
color: #4b5563;
}
/* --- 4. Sidebar Input Styling --- */
/* Number Input: The actual number text */
[data-testid="stSidebar"] [data-testid="stNumberInput"] input {
font-size: 1.4rem !important;
font-weight: 700 !important;
color: #ff4b4b; /* Matches your theme color */
padding-top: 5px;
padding-bottom: 5px;
}
/* Slider: Min/Max/Current Values */
[data-testid="stSidebar"] [data-testid="stTickBarMin"],
[data-testid="stSidebar"] [data-testid="stTickBarMax"] {
font-size: 1rem !important;
font-weight: 600 !important;
}
/* Slider: The Hover/Drag Value Popup */
[data-testid="stSidebar"] .stSlider [data-testid="stThumbValue"] {
font-size: 1.2rem !important;
font-weight: bold !important;
}
/* --- 5. Main Dashboard Components --- */
.metric-card {
background-color: #ffffff;
padding: 20px;
border-radius: 12px;
text-align: center;
margin-bottom: 15px;
border: 1px solid #e5e7eb;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.big-number {
font-size: 3.5rem;
font-weight: 800;
color: #ff4b4b;
margin: 10px 0;
line-height: 1;
}
.sub-text {
font-size: 1.6rem;
font-weight: 500;
color: #36454F;
}
/* Custom Spacer for Sidebar */
.spacer {
margin-top: 1.5rem;
margin-bottom: 1.5rem;
height: 1px;
background-color: #e5e7eb; /* Subtle divider line */
}
/* --- 6. Layout Tweaks --- */
/* Removes the large gap at the top of the page */
.block-container {
padding-top: 5rem !important;
padding-bottom: 0rem !important;
}
</style>
""", unsafe_allow_html=True)
# --- Title ---
#st.title("🌍 The Climate Cost of the AI Race ⛽️")
# --- Sidebar Inputs ---
st.sidebar.markdown("""
**What will the US emissions of AI be in 2030?** Model the 3 variables below to see.
""")
st.sidebar.markdown('<div class="spacer"></div>', unsafe_allow_html=True)
# 1. AI Power Demand
st.sidebar.markdown('<p class="sidebar-question">1. How much power will AI require in 2030? (GW)</p>', unsafe_allow_html=True)
ai_demand_gw = st.sidebar.number_input(
"Demand (GW)",
value=100,
step=10,
format="%d",
label_visibility="collapsed"
)
with st.sidebar.expander("More on AI Demand Forecasts"):
st.markdown("""
Current forecasts vary wildly, suggesting US AI data centers will need anywhere from **50 GW to over 250 GW** in the coming decade.$^{1,2,3}$
* Epoch AI analysts currently project that **100 GW** is the best forecast for AI power demand by 2030, representing roughly **10% of America's total peak power capacity**, requiring growth rates not seen since the 1980s.$^{1}$
* Anthropic projects the U.S. AI sector needs at least **50 GW** by 2028 to maintain global leadership, which is roughly double the peak electricity demand of New York City.$^{2}$
* OpenAI leadership has indicated a desire for up to **250 GW** of power by 2033 to support future model scaling.$^{3}$
*Sources:*
1. [Epoch AI: America's AI Power Problem (Dec 2025)](https://epoch.ai/gradient-updates/is-almost-everyone-wrong-about-americas-ai-power-problem)
2. [Anthropic: Build AI in America (July 2025)](https://www.anthropic.com/news/build-ai-in-america)
3. [The Information: Sam Altman Wants 250 GW (2025)](https://www.theinformation.com/articles/sam-altman-wants-250-gigawatts-power-possible)
""")
st.sidebar.markdown('<div class="spacer"></div>', unsafe_allow_html=True)
# 2. Gas Share
st.sidebar.markdown('<p class="sidebar-question">2. What proportion of this power will be supplied by natural gas?</p>', unsafe_allow_html=True)
gas_share = st.sidebar.slider(
"Gas Share",
min_value=0, max_value=100, value=90, step=5,
format="%d%%",
label_visibility="collapsed"
)
with st.sidebar.expander("More on Energy Mix"):
st.markdown("""
**Why Gas?**
The electric grid in major hubs like Texas is effectively "sold out," with wait times for connection approaching 5 years. To bypass this, AI labs are adopting "Bring Your Own Generation" (BYOG) strategies, primarily using natural gas which can be deployed in months rather than years. In fact, current projections suggest that **nearly a third of all new data center development will deploy behind-the-meter (BTM) gas generation** to circumvent these bottlenecks.$^{1,2}$
Even when projects connected to the grid, natural gas is the backbone of the US power system, accounting for approximately **43% of total utility-scale electricity generation** in 2023.$^{3,4}$
"Demand response" (or data center flexibility) could theoretically pull gigawatts "out of thin air" by matching AI training jobs to times when the grid has spare capacity.$^{5}$ However, many experts remain skeptical of the true magnitude of this solution, as large-scale implementation faces significant technical hurdles and pushback from major grid operators like PJM.$^{5,6}$
**What about Solar?**
While solar prices have dropped ~88% since 2009, it faces physical limits. 2 GW of solar requires a land area roughly the size of Manhattan (approx. 60 km²). Solar requires massive battery storage for 24/7 reliability, adding complexity for off-grid "island" data centers that cannot draw on spare grid capacity at night.$^{5}$
*Sources:*
1. [Latitude Media (Jan 2026)](https://www.latitudemedia.com/news/what-the-michigan-stargate-site-says-about-todays-ai-market)
2. [JLL 2026 Global Data Center Outlook](https://www.jll.com/en-us/insights/market-outlook/data-center-outlook)
3. [U.S. Energy Information Administration (EIA)](https://www.eia.gov/energyexplained/electricity/electricity-in-the-us.php)
4. [Ember Energy - U.S. Country Profile](https://ember-energy.org/countries-and-regions/united-states-of-america/)
5. [Epoch AI: America's AI Power Problem (Dec 2025)](https://epoch.ai/gradient-updates/is-almost-everyone-wrong-about-americas-ai-power-problem)
6. [Woodway Energy: Bridging the 5-Year Gap](https://www.woodwayenergy.com/off-grid-btm-gas-power-generation-data-centers/)
""")
st.sidebar.markdown('<div class="spacer"></div>', unsafe_allow_html=True)
# 3. Turbine Efficiency
st.sidebar.markdown('<p class="sidebar-question">3. What will the efficiency of the gas turbines be?</p>', unsafe_allow_html=True)
turbine_eff_percent = st.sidebar.slider(
"Efficiency",
min_value=35, max_value=60, value=45, step=1,
format="%d%%",
label_visibility="collapsed"
)
with st.sidebar.expander("More on Turbine Tech"):
st.markdown("""
**Trade-offs: Efficiency vs. Speed**: The efficiency of gas turbines, which determines their carbon emissions, varies from 35-60%. The most efficient, are, generally, the slowest to build. In frontier data centers, AI chips cost roughly 10x more than the power infrastructure, driving companies to prioritize deployment speed over energy efficiency.
* **Aeroderivative (35-40%):** Modified jet engines (e.g., GE LM2500). They are less efficient but can be deployed in weeks via truck. xAI used these to bypass multi-year grid delays.
* **Reciprocating Engines (40-50%):** Modular internal combustion engines (e.g., Wärtsilä). They maintain high efficiency even at partial loads, making them ideal for flexible "demand response" strategies.
* **Combined Cycle (50-60%):** The gold standard, using waste heat to drive a steam turbine. However, lead times of **36-60 months** make them too slow for the current AI race. These are representative of utility-scale gas turbines.
* **Solid Oxide Fuel Cells (50-55%):** (e.g., Bloom Energy). These offer high efficiency and fast deployment (no combustion permitting), but come with a high capital cost.
[Source](https://open.substack.com/pub/semianalysis/p/how-ai-labs-are-solving-the-power)
""")
# Constants
CAPACITY_FACTOR = 0.90
US_BASELINE_MMT = 4900
FUEL_CARBON_CONSTANT = 486 * 0.60
# --- Calculations ---
# 1. Calculate Emissions Factor
if turbine_eff_percent > 0:
calculated_ef = FUEL_CARBON_CONSTANT / (turbine_eff_percent / 100)
else:
calculated_ef = 0
# 2. Calculate Total Energy
gas_gw_capacity = ai_demand_gw * (gas_share/100)
total_gwh = gas_gw_capacity * CAPACITY_FACTOR * 8760
# 3. Calculate Emissions (MMT CO2e)
ai_emissions_mmt = (total_gwh * calculated_ef) / 1_000_000
percent_increase = (ai_emissions_mmt / US_BASELINE_MMT) * 100
# --- Dashboard Layout ---
# 1. The Big Number
c1, c2, c3 = st.columns([1, 2, 1])
with c2:
st.markdown(f"""
<div class="metric-card">
<div class="sub-text">2030 US Energy/Industry Emissions Increase due to AI</div>
<div class="big-number">+{percent_increase:.2f}%</div>
<div class="sub-text">{ai_emissions_mmt:.1f} Million tCO<sub>2</sub>e</div>
<div style="font-size: 1em; color: #888; margin-top: 10px;">
</div>
</div>
""", unsafe_allow_html=True)
# 2. Charts
years = [2020, 2021, 2022, 2023, 2024]
emissions_hist = [4690, 5020, 5060, 4920, 4900]
target_2030 = 3065
bau_2030 = 4900
fig1 = go.Figure()
# History Line
fig1.add_trace(go.Scatter(
x=years, y=emissions_hist,
mode='lines+markers',
name='Historical CO₂',
line=dict(color='lightgray', width=4),
marker=dict(size=12)
))
fig1.add_trace(go.Scatter(
x=[2030], y=[target_2030],
mode='markers',
name='2030 Climate Goal',
marker=dict(color='green', size=15, symbol='circle')
))
fig1.add_trace(go.Bar(
x=[2030], y=[bau_2030],
name='2030 Baseline Estimate',
marker_color='lightgray'
))
fig1.add_trace(go.Bar(
x=[2030], y=[ai_emissions_mmt],
name='Additional AI Gas Emissions',
base=bau_2030,
marker_color='#ff4b4b'
))
fig1.update_layout(
height=650,
font=dict(size=18),
title={
'text': "US Emissions Trajectory vs. AI Impact",
'font': {'size': 22},
'x': 0.5,
'xanchor': 'center',
'y': 0.9, # Keeps title low and close to the chart
'yanchor': 'top'
},
yaxis={
'title': {
'text': "Emissions (Million tCO<sub>2</sub>)",
'font': {'size': 20}
},
'tickfont': {'size': 16}
},
xaxis={
'tickfont': {'size': 16}
},
barmode='stack',
legend={
'orientation': "h",
'y': -0.15,
'x': 0.5,
'xanchor': 'center',
'font': {'size': 18}
},
margin=dict(l=50, r=50, t=80, b=100),
hovermode="x unified"
)
st.plotly_chart(fig1, use_container_width=True)
st.markdown("---")
with st.expander("Methodology"):
st.markdown(f"""
**Baseline & Context**
* Annual CO₂ emissions data from [Our World in Data](https://ourworldindata.org/profile/co2/united-states) (fossil fuels and industry) is used to visualize the 2020-2024 trajectory.
* The 2030 percentage increase is calculated against the 2024 annual CO₂ emissions (approx. {US_BASELINE_MMT} Million TCO₂e).
* 2030 Climate Goal is based on the Paris Agreement commitment to halve 2005 emissions (6130 TCO₂e).
**The Physics of Efficiency:**
The critical driver in this model is **Thermal Efficiency** ($\eta$).
* Lower efficiency turbines (like simple-cycle Aeroderivatives) must burn *more* fuel to generate the same amount of electricity. Therefore, emissions scale inversely with efficiency.
* We use [NREL Life Cycle Assessment](https://docs.nrel.gov/docs/fy21osti/80580.pdf) data for a modern Combined Cycle Gas Turbine (CCGT) as the anchor: **486 gCO₂e/kWh @ 60% efficiency**.
* This implies a fuel carbon content constant ($C_{{fuel}}$) of approx. **291.6**.
$$ EF_{{scenario}} = \\frac{{291.6}}{{\\eta_{{selected}}}} $$
*Example:* A 35% efficient turbine results in an emissions factor of ~833 gCO₂e/kWh ($291.6 / 0.35$).
**Total Emissions Formula:**
The final annual emissions ($E_{{total}}$) are calculated as:
$$ E_{{total}} = P_{{GW}} \\times 8,760 \\times CF \\times S_{{gas}} \\times EF_{{scenario}} $$
* $P_{{GW}}$: AI Power Demand (selected in sidebar).
* $8,760$: Total hours in a year.
* $CF$: **Capacity Factor (90%)**. Fixed to represent the "always-on" baseload nature of AI data centers, which run significantly harder than typical residential usage.
* $S_{{gas}}$: The % of that power demand supplied by Natural Gas (vs. zero-carbon sources or flexibility), selected in sidebar.
**Assumptions:** Assumes only natural gas emissions, and that all other power infrastructure is non-emitting. In reality, even clean energy technologies have emissions, and coal could be used. Assumes only direct emissions, ignores indirect emissions or reductions.
""") |