Spaces:
Sleeping
Sleeping
Commit ·
037091e
1
Parent(s): e2f537d
layout fixes (#18)
Browse files- update layout (abb3339337ba80ce85705197e861e0b21e9800d0)
- src/app.py +23 -24
src/app.py
CHANGED
|
@@ -758,24 +758,37 @@ with tab_single:
|
|
| 758 |
else:
|
| 759 |
# Create two columns for side-by-side display
|
| 760 |
col_result, col_candidates = st.columns([1.2, 1])
|
| 761 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 762 |
# ========================================================================
|
| 763 |
# LEFT COLUMN: Résultat de l'impact carbone
|
| 764 |
# ========================================================================
|
| 765 |
with col_result:
|
| 766 |
with st.container():
|
| 767 |
st.markdown("### 📊 Résultat de l'impact carbone")
|
| 768 |
-
|
| 769 |
-
# Calculer l'impact pour l'affichage
|
| 770 |
-
if result.impact_kg_co2_eq is not None:
|
| 771 |
-
if "tonne" in (result.unite_source or ""):
|
| 772 |
-
impact_kg_t = result.impact_kg_co2_eq
|
| 773 |
-
else:
|
| 774 |
-
impact_kg_t = result.impact_kg_co2_eq * 1000.0
|
| 775 |
|
| 776 |
st.metric(
|
| 777 |
-
label="Impact carbone (MP)",
|
| 778 |
-
value=f"{
|
| 779 |
delta="kg CO2 eq / t produit",
|
| 780 |
)
|
| 781 |
|
|
@@ -800,20 +813,6 @@ with tab_single:
|
|
| 800 |
|
| 801 |
st.markdown("---")
|
| 802 |
|
| 803 |
-
|
| 804 |
-
# --- Forfait transport ---
|
| 805 |
-
transport_val, transport_zone = _get_transport_surcharge(
|
| 806 |
-
pays_production=result.pays_production,
|
| 807 |
-
pays_transformation=result.pays_transformation,
|
| 808 |
-
type_mp=type_mp_code,
|
| 809 |
-
source_db=result.source_db,
|
| 810 |
-
classification=result.classification,
|
| 811 |
-
)
|
| 812 |
-
|
| 813 |
-
# --- Forfait extrusion ---
|
| 814 |
-
extrusion_val = config.FORFAIT_EXTRUSION if extrusion_single else 0.0
|
| 815 |
-
impact_total = impact_kg_t + transport_val + extrusion_val
|
| 816 |
-
|
| 817 |
# Affichage des impacts
|
| 818 |
st.markdown("#### 🎯 Impacts calculés")
|
| 819 |
|
|
|
|
| 758 |
else:
|
| 759 |
# Create two columns for side-by-side display
|
| 760 |
col_result, col_candidates = st.columns([1.2, 1])
|
| 761 |
+
|
| 762 |
+
# Calculer l'impact pour l'affichage
|
| 763 |
+
if result.impact_kg_co2_eq is not None:
|
| 764 |
+
if "tonne" in (result.unite_source or ""):
|
| 765 |
+
impact_kg_t = result.impact_kg_co2_eq
|
| 766 |
+
else:
|
| 767 |
+
impact_kg_t = result.impact_kg_co2_eq * 1000.0
|
| 768 |
+
|
| 769 |
+
# --- Forfait transport ---
|
| 770 |
+
transport_val, transport_zone = _get_transport_surcharge(
|
| 771 |
+
pays_production=result.pays_production,
|
| 772 |
+
pays_transformation=result.pays_transformation,
|
| 773 |
+
type_mp=type_mp_code,
|
| 774 |
+
source_db=result.source_db,
|
| 775 |
+
classification=result.classification,
|
| 776 |
+
)
|
| 777 |
+
|
| 778 |
+
# --- Forfait extrusion ---
|
| 779 |
+
extrusion_val = config.FORFAIT_EXTRUSION if extrusion_single else 0.0
|
| 780 |
+
impact_total = impact_kg_t + transport_val + extrusion_val
|
| 781 |
+
|
| 782 |
# ========================================================================
|
| 783 |
# LEFT COLUMN: Résultat de l'impact carbone
|
| 784 |
# ========================================================================
|
| 785 |
with col_result:
|
| 786 |
with st.container():
|
| 787 |
st.markdown("### 📊 Résultat de l'impact carbone")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 788 |
|
| 789 |
st.metric(
|
| 790 |
+
label="🌍 Impact carbone Total (MP + Transport)",
|
| 791 |
+
value=f"{impact_total:.2f}",
|
| 792 |
delta="kg CO2 eq / t produit",
|
| 793 |
)
|
| 794 |
|
|
|
|
| 813 |
|
| 814 |
st.markdown("---")
|
| 815 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 816 |
# Affichage des impacts
|
| 817 |
st.markdown("#### 🎯 Impacts calculés")
|
| 818 |
|