Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -13,6 +13,11 @@ st.set_page_config(
|
|
| 13 |
# --- Custom CSS ---
|
| 14 |
st.markdown("""
|
| 15 |
<style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
/* Set Global Font */
|
| 17 |
html, body, [class*="css"] {
|
| 18 |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
@@ -72,16 +77,17 @@ st.markdown("""
|
|
| 72 |
|
| 73 |
# --- Title ---
|
| 74 |
st.title("🌍 The Climate Cost of the AI Race ⛽️")
|
| 75 |
-
st.markdown("""
|
| 76 |
-
**What will the US emissions of AI be in 2030?** Model the variables below, focused on the efficiency of Natural Gas deployment.
|
| 77 |
-
""")
|
| 78 |
|
| 79 |
st.divider()
|
| 80 |
|
| 81 |
# --- Sidebar Inputs ---
|
|
|
|
|
|
|
|
|
|
| 82 |
st.sidebar.header("⚙️ Scenario Settings")
|
| 83 |
st.sidebar.markdown("---")
|
| 84 |
|
|
|
|
| 85 |
# 1. AI Power Demand
|
| 86 |
st.sidebar.markdown('<p class="sidebar-question">1. How much power will AI require in 2030?</p>', unsafe_allow_html=True)
|
| 87 |
ai_demand_gw = st.sidebar.number_input(
|
|
@@ -102,7 +108,6 @@ gas_share = st.sidebar.slider(
|
|
| 102 |
min_value=0, max_value=100, value=90, step=5,
|
| 103 |
label_visibility="collapsed"
|
| 104 |
)
|
| 105 |
-
st.sidebar.caption(f"Selected: **{gas_share}%**")
|
| 106 |
|
| 107 |
with st.sidebar.expander("More on Energy Mix"):
|
| 108 |
st.markdown("""
|
|
@@ -113,6 +118,7 @@ with st.sidebar.expander("More on Energy Mix"):
|
|
| 113 |
While solar prices have dropped ~88% since 2009, it faces physical limits:
|
| 114 |
* **Land Use:** 2 GW of solar requires a land area roughly the size of Manhattan.
|
| 115 |
* **Uptime:** Solar requires battery backup for 24/7 reliability, adding complexity for off-grid "island" data centers.
|
|
|
|
| 116 |
[Source](https://open.substack.com/pub/semianalysis/p/how-ai-labs-are-solving-the-power)
|
| 117 |
""")
|
| 118 |
|
|
@@ -125,7 +131,6 @@ turbine_eff_percent = st.sidebar.slider(
|
|
| 125 |
min_value=35, max_value=60, value=45, step=1,
|
| 126 |
label_visibility="collapsed"
|
| 127 |
)
|
| 128 |
-
st.sidebar.caption(f"Selected: **{turbine_eff_percent}%**")
|
| 129 |
|
| 130 |
with st.sidebar.expander("More on Turbine Tech"):
|
| 131 |
st.markdown("""
|
|
@@ -134,6 +139,7 @@ with st.sidebar.expander("More on Turbine Tech"):
|
|
| 134 |
* **Aeroderivative (35-40%):** Modified jet engines (e.g., GE LM2500). They are less efficient but fast to deploy. Companies like xAI use them to bypass grid delays.
|
| 135 |
* **Reciprocating Engines (40-50%):** Modular internal combustion engines (e.g., Wärtsilä). They offer higher efficiency than aeroderivatives and handle partial loads well.
|
| 136 |
* **Combined Cycle (50-60%):** The gold standard for efficiency, using waste heat to drive a steam turbine. However, they take 36-60 months to build, making them too slow for the current AI race.
|
|
|
|
| 137 |
[Source](https://open.substack.com/pub/semianalysis/p/how-ai-labs-are-solving-the-power)
|
| 138 |
""")
|
| 139 |
|
|
@@ -211,14 +217,29 @@ fig1.add_trace(go.Bar(
|
|
| 211 |
))
|
| 212 |
|
| 213 |
fig1.update_layout(
|
| 214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
barmode='stack',
|
| 216 |
-
|
| 217 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 218 |
),
|
| 219 |
-
|
| 220 |
-
height=500,
|
| 221 |
-
margin=dict(l=40, r=40, t=40, b=40),
|
| 222 |
hovermode="x unified"
|
| 223 |
)
|
| 224 |
|
|
|
|
| 13 |
# --- Custom CSS ---
|
| 14 |
st.markdown("""
|
| 15 |
<style>
|
| 16 |
+
/* Force Global Sans-Serif Font */
|
| 17 |
+
html, body, [class*="css"], .stMarkdown {
|
| 18 |
+
font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
/* Set Global Font */
|
| 22 |
html, body, [class*="css"] {
|
| 23 |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
|
|
| 77 |
|
| 78 |
# --- Title ---
|
| 79 |
st.title("🌍 The Climate Cost of the AI Race ⛽️")
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
st.divider()
|
| 82 |
|
| 83 |
# --- Sidebar Inputs ---
|
| 84 |
+
st.sidebar.markdown("""
|
| 85 |
+
**What will the US emissions of AI be in 2030?** Model the variables below, focused on the efficiency of Natural Gas deployment.
|
| 86 |
+
""")
|
| 87 |
st.sidebar.header("⚙️ Scenario Settings")
|
| 88 |
st.sidebar.markdown("---")
|
| 89 |
|
| 90 |
+
|
| 91 |
# 1. AI Power Demand
|
| 92 |
st.sidebar.markdown('<p class="sidebar-question">1. How much power will AI require in 2030?</p>', unsafe_allow_html=True)
|
| 93 |
ai_demand_gw = st.sidebar.number_input(
|
|
|
|
| 108 |
min_value=0, max_value=100, value=90, step=5,
|
| 109 |
label_visibility="collapsed"
|
| 110 |
)
|
|
|
|
| 111 |
|
| 112 |
with st.sidebar.expander("More on Energy Mix"):
|
| 113 |
st.markdown("""
|
|
|
|
| 118 |
While solar prices have dropped ~88% since 2009, it faces physical limits:
|
| 119 |
* **Land Use:** 2 GW of solar requires a land area roughly the size of Manhattan.
|
| 120 |
* **Uptime:** Solar requires battery backup for 24/7 reliability, adding complexity for off-grid "island" data centers.
|
| 121 |
+
|
| 122 |
[Source](https://open.substack.com/pub/semianalysis/p/how-ai-labs-are-solving-the-power)
|
| 123 |
""")
|
| 124 |
|
|
|
|
| 131 |
min_value=35, max_value=60, value=45, step=1,
|
| 132 |
label_visibility="collapsed"
|
| 133 |
)
|
|
|
|
| 134 |
|
| 135 |
with st.sidebar.expander("More on Turbine Tech"):
|
| 136 |
st.markdown("""
|
|
|
|
| 139 |
* **Aeroderivative (35-40%):** Modified jet engines (e.g., GE LM2500). They are less efficient but fast to deploy. Companies like xAI use them to bypass grid delays.
|
| 140 |
* **Reciprocating Engines (40-50%):** Modular internal combustion engines (e.g., Wärtsilä). They offer higher efficiency than aeroderivatives and handle partial loads well.
|
| 141 |
* **Combined Cycle (50-60%):** The gold standard for efficiency, using waste heat to drive a steam turbine. However, they take 36-60 months to build, making them too slow for the current AI race.
|
| 142 |
+
|
| 143 |
[Source](https://open.substack.com/pub/semianalysis/p/how-ai-labs-are-solving-the-power)
|
| 144 |
""")
|
| 145 |
|
|
|
|
| 217 |
))
|
| 218 |
|
| 219 |
fig1.update_layout(
|
| 220 |
+
height=650, # Increased height
|
| 221 |
+
font=dict(size=18), # Global font scale
|
| 222 |
+
title=dict(
|
| 223 |
+
text="Can we hit the 50% reduction target?",
|
| 224 |
+
font=dict(size=24) # Explicit title size
|
| 225 |
+
),
|
| 226 |
+
yaxis=dict(
|
| 227 |
+
title="Emissions (Million tCO2e)",
|
| 228 |
+
titlefont=dict(size=20),
|
| 229 |
+
tickfont=dict(size=16)
|
| 230 |
+
),
|
| 231 |
+
xaxis=dict(
|
| 232 |
+
tickfont=dict(size=16)
|
| 233 |
+
),
|
| 234 |
barmode='stack',
|
| 235 |
+
legend=dict(
|
| 236 |
+
orientation="h",
|
| 237 |
+
y=-0.2,
|
| 238 |
+
x=0.5,
|
| 239 |
+
xanchor='center',
|
| 240 |
+
font=dict(size=18) # Larger legend text
|
| 241 |
),
|
| 242 |
+
margin=dict(l=50, r=50, t=80, b=50),
|
|
|
|
|
|
|
| 243 |
hovermode="x unified"
|
| 244 |
)
|
| 245 |
|