engrmuhammadrizwan01 commited on
Commit
eabbd86
·
verified ·
1 Parent(s): 979d894

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -0
app.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.set_page_config(page_title="Block Quantity Calculator", layout="centered")
4
+
5
+ st.title("🧱 Blocks Quantity Calculation")
6
+
7
+ unit = st.selectbox("Select Unit", ["m", "cm"])
8
+
9
+ def convert_to_m(val, unit):
10
+ return val / 100 if unit == "cm" else val
11
+
12
+ st.subheader("Dimension of Wall")
13
+ wall_length = convert_to_m(st.number_input("Wall Length (L)", value=0.0), unit)
14
+ wall_height = convert_to_m(st.number_input("Wall Height (H)", value=0.0), unit)
15
+ wall_thickness = convert_to_m(st.number_input("Wall Thickness (T)", value=0.0), unit)
16
+
17
+ st.subheader("Dimension of Block")
18
+ block_length = convert_to_m(st.number_input("Block Length", value=0.0), unit)
19
+ block_width = convert_to_m(st.number_input("Block Width", value=0.0), unit)
20
+ block_height = convert_to_m(st.number_input("Block Height", value=0.0), unit)
21
+
22
+ st.subheader("Mortar Ratio")
23
+ cement_ratio = st.number_input("Cement", value=1.0)
24
+ sand_ratio = st.number_input("Sand", value=2.5)
25
+ ratio_total = cement_ratio + sand_ratio
26
+
27
+ subtract_area = st.number_input("Subtract Area (Windows/Doors) in m²", value=0.0)
28
+ block_price = st.number_input("Block Price (per unit)", value=0.0)
29
+
30
+ if st.button("Calculate"):
31
+ wall_volume = wall_length * wall_height * wall_thickness - subtract_area
32
+ block_volume = block_length * block_height * block_width
33
+ number_of_blocks = wall_volume / block_volume
34
+ dry_mortar_volume = wall_volume * 0.21
35
+ cement_volume = dry_mortar_volume * (cement_ratio / ratio_total)
36
+ sand_volume = dry_mortar_volume * (sand_ratio / ratio_total)
37
+ cement_bags = cement_volume / 0.0347
38
+ total_cost = number_of_blocks * block_price
39
+
40
+ st.markdown("### 📋 Results")
41
+ st.write(f"**Wall Volume:** {wall_volume:.2f} m³")
42
+ st.write(f"**Number of Blocks:** {number_of_blocks:.2f}")
43
+ st.write(f"**Dry Mortar:** {dry_mortar_volume:.2f} m³")
44
+ st.write(f"**Cement Volume:** {cement_volume:.2f} m³")
45
+ st.write(f"**Sand Volume:** {sand_volume:.2f} m³")
46
+ st.write(f"**Cement Bags (50kg):** {cement_bags:.2f} bags")
47
+ st.write(f"**Blocks Cost:** ${total_cost:.2f}")