engrmuhammadrizwan01 commited on
Commit
4091ac7
·
verified ·
1 Parent(s): 0ca044c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +37 -34
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
 
3
  st.set_page_config(page_title="🧱 Block Quantity Calculator", layout="centered")
4
 
5
- st.title("🧱 Block Quantity Calculator")
6
 
7
  unit = st.selectbox("Choose Unit", ["m", "cm"])
8
 
@@ -27,9 +27,9 @@ cement = st.number_input("Cement Ratio", value=1.0)
27
  sand = st.number_input("Sand Ratio", value=2.5)
28
  ratio_sum = cement + sand
29
 
30
- # Other Inputs
31
  st.subheader("Additional Inputs")
32
- deduct_area = st.number_input("Deducted Area (e.g., windows/doors) in m²", value=0.0)
33
  block_price = st.number_input("Block Price (optional)", value=0.0)
34
 
35
  if st.button("Calculate"):
@@ -44,34 +44,37 @@ if st.button("Calculate"):
44
 
45
  st.markdown("## 📘 Calculation Breakdown")
46
 
47
- st.markdown(f"""
48
- ### 🧱 Wall Volume
49
- **Formula:** `Length × Height × Thickness - Deducted Area`
50
- **=** {L:.2f} × {H:.2f} × {T:.2f} - {deduct_area:.2f}
51
- **= {wall_vol:.2f} m³**
52
-
53
- ### 🧱 Block Volume
54
- **Formula:** `Length × Height × Width`
55
- **=** {BL:.2f} × {BH:.2f} × {BW:.2f}
56
- **= {block_vol:.4f} m³**
57
-
58
- ### 🔢 Number of Blocks
59
- **Formula:** `Wall Volume ÷ Block Volume`
60
- **=** {wall_vol:.2f} ÷ {block_vol:.4f}
61
- **= {num_blocks:.0f} blocks**
62
-
63
- ### 🧪 Dry Mortar Volume
64
- **Formula:** `Wall Volume × 0.21`
65
- **=** {wall_vol:.2f} × 0.21
66
- **= {dry_mortar:.2f} m³**
67
-
68
- ### 🧱 Cement & Sand Volume
69
- **Cement Volume:**
70
- **=** {dry_mortar:.2f} × ({cement} / {ratio_sum}) = {cement_vol:.2f} m³
71
- **Sand Volume:**
72
- **=** {dry_mortar:.2f} × ({sand} / {ratio_sum}) = {sand_vol:.2f} m³
73
-
74
- ### 🧱 Cement Bags
75
- **Formula:** `Cement Volume ÷ 0.0347`
76
- **=** {cement_vol:.2f} ÷ 0.0347
77
- **= {cement_bags:.0f} bags_**
 
 
 
 
2
 
3
  st.set_page_config(page_title="🧱 Block Quantity Calculator", layout="centered")
4
 
5
+ st.title("🧱 Block Quantity Calculator with Formula Explanation")
6
 
7
  unit = st.selectbox("Choose Unit", ["m", "cm"])
8
 
 
27
  sand = st.number_input("Sand Ratio", value=2.5)
28
  ratio_sum = cement + sand
29
 
30
+ # Additional Inputs
31
  st.subheader("Additional Inputs")
32
+ deduct_area = st.number_input("Deducted Area (e.g., doors/windows) in m²", value=0.0)
33
  block_price = st.number_input("Block Price (optional)", value=0.0)
34
 
35
  if st.button("Calculate"):
 
44
 
45
  st.markdown("## 📘 Calculation Breakdown")
46
 
47
+ st.markdown(f"""### 🧱 Wall Volume
48
+ **Formula:** `Length × Height × Thickness - Deducted Area`
49
+ **=** {L:.2f} × {H:.2f} × {T:.2f} - {deduct_area:.2f}
50
+ **= {wall_vol:.2f} m³**
51
+
52
+ ### 🧱 Block Volume
53
+ **Formula:** `Length × Height × Width`
54
+ **=** {BL:.2f} × {BH:.2f} × {BW:.2f}
55
+ **= {block_vol:.4f} m³**
56
+
57
+ ### 🔢 Number of Blocks
58
+ **Formula:** `Wall Volume ÷ Block Volume`
59
+ **=** {wall_vol:.2f} ÷ {block_vol:.4f}
60
+ **= {num_blocks:.0f} blocks**
61
+
62
+ ### 🧪 Dry Mortar Volume
63
+ **Formula:** `Wall Volume × 0.21`
64
+ **=** {wall_vol:.2f} × 0.21
65
+ **= {dry_mortar:.2f} m³**
66
+
67
+ ### 🧱 Cement & Sand Volume
68
+ **Cement Volume:** {dry_mortar:.2f} × ({cement} / {ratio_sum}) = {cement_vol:.2f} m³
69
+ **Sand Volume:** {dry_mortar:.2f} × ({sand} / {ratio_sum}) = {sand_vol:.2f} m³
70
+
71
+ ### 🧱 Cement Bags
72
+ **Formula:** `Cement Volume ÷ 0.0347`
73
+ **=** {cement_vol:.2f} ÷ 0.0347
74
+ **= {cement_bags:.0f} bags**
75
+
76
+ ### 💰 Total Cost (Optional)
77
+ **Formula:** `Number of Blocks × Block Price`
78
+ **=** {num_blocks:.0f} × {block_price:.2f}
79
+ **= ${cost:.2f}**
80
+ """)