Update app.py
Browse files
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 |
-
#
|
| 31 |
st.subheader("Additional Inputs")
|
| 32 |
-
deduct_area = st.number_input("Deducted Area (e.g.,
|
| 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 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
""")
|