entropy25 commited on
Commit
7e0936f
·
verified ·
1 Parent(s): 26fbeab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -44
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
- # Split metrics into two columns
876
- mid_point = min(4, len(all_metrics))
877
- left_metrics = all_metrics[:mid_point]
878
- right_metrics = all_metrics[mid_point:]
879
-
880
- col1, col2 = st.columns(4)
881
-
882
- with col1:
883
- for item in left_metrics:
884
- if item == '_total_':
885
- info = stats['_total_']
886
- st.metric(
887
- label="Total Production",
888
- value=f"{info['total']:,.0f} kg",
889
- delta="100% of total"
890
- )
891
- st.caption(f"Daily avg: {info['daily_avg']:,.0f} kg")
892
- else:
893
- info = stats[item]
894
- st.metric(
895
- label=item.replace('_', ' ').title(),
896
- value=f"{info['total']:,.0f} kg",
897
- delta=f"{info['percentage']:.1f}% of total"
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])