Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -872,50 +872,29 @@ def main():
|
|
| 872 |
materials = [k for k in stats.keys() if k != '_total_']
|
| 873 |
all_metrics = materials + ['_total_']
|
| 874 |
|
| 875 |
-
#
|
| 876 |
-
|
| 877 |
-
|
| 878 |
-
|
| 879 |
-
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
)
|
| 899 |
-
st.caption(f"Daily avg: {info['daily_avg']:,.0f} kg")
|
| 900 |
-
|
| 901 |
-
with col2:
|
| 902 |
-
for item in right_metrics:
|
| 903 |
-
if item == '_total_':
|
| 904 |
-
info = stats['_total_']
|
| 905 |
-
st.metric(
|
| 906 |
-
label="Total Production",
|
| 907 |
-
value=f"{info['total']:,.0f} kg",
|
| 908 |
-
delta="100% of total"
|
| 909 |
-
)
|
| 910 |
-
st.caption(f"Daily avg: {info['daily_avg']:,.0f} kg")
|
| 911 |
-
else:
|
| 912 |
-
info = stats[item]
|
| 913 |
-
st.metric(
|
| 914 |
-
label=item.replace('_', ' ').title(),
|
| 915 |
-
value=f"{info['total']:,.0f} kg",
|
| 916 |
-
delta=f"{info['percentage']:.1f}% of total"
|
| 917 |
-
)
|
| 918 |
-
st.caption(f"Daily avg: {info['daily_avg']:,.0f} kg")
|
| 919 |
|
| 920 |
st.markdown('<div class="section-header">📊 Production Trends</div>', unsafe_allow_html=True)
|
| 921 |
col1, col2 = st.columns([3, 1])
|
|
|
|
| 872 |
materials = [k for k in stats.keys() if k != '_total_']
|
| 873 |
all_metrics = materials + ['_total_']
|
| 874 |
|
| 875 |
+
# Display metrics in rows of 4
|
| 876 |
+
for i in range(0, len(all_metrics), 4):
|
| 877 |
+
row_metrics = all_metrics[i:i+4]
|
| 878 |
+
cols = st.columns(len(row_metrics))
|
| 879 |
+
|
| 880 |
+
for j, item in enumerate(row_metrics):
|
| 881 |
+
with cols[j]:
|
| 882 |
+
if item == '_total_':
|
| 883 |
+
info = stats['_total_']
|
| 884 |
+
st.metric(
|
| 885 |
+
label="Total Production",
|
| 886 |
+
value=f"{info['total']:,.0f} kg",
|
| 887 |
+
delta="100% of total"
|
| 888 |
+
)
|
| 889 |
+
st.caption(f"Daily avg: {info['daily_avg']:,.0f} kg")
|
| 890 |
+
else:
|
| 891 |
+
info = stats[item]
|
| 892 |
+
st.metric(
|
| 893 |
+
label=item.replace('_', ' ').title(),
|
| 894 |
+
value=f"{info['total']:,.0f} kg",
|
| 895 |
+
delta=f"{info['percentage']:.1f}% of total"
|
| 896 |
+
)
|
| 897 |
+
st.caption(f"Daily avg: {info['daily_avg']:,.0f} kg")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 898 |
|
| 899 |
st.markdown('<div class="section-header">📊 Production Trends</div>', unsafe_allow_html=True)
|
| 900 |
col1, col2 = st.columns([3, 1])
|