Abdullah-Basar commited on
Commit
baf2168
·
verified ·
1 Parent(s): 974f251

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -0
app.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ # Title and Description
4
+ st.title("🏗️ Brick Masonry Estimator")
5
+ st.write("""
6
+ This app estimates the number of bricks and the amount of mortar required for constructing a wall.
7
+ Input the dimensions of the wall and the bricks, and the app will calculate the required quantities.
8
+ """)
9
+
10
+ # Sidebar Instructions
11
+ st.sidebar.title("Instructions")
12
+ st.sidebar.write("""
13
+ 1. Enter the dimensions of the wall (height, length, and thickness in meters).
14
+ 2. Enter the dimensions of a single brick (height, length, and width in meters).
15
+ 3. Click the **Estimate Requirements** button to calculate the number of bricks and mortar volume.
16
+ 4. Reset inputs using the **Clear Inputs** button.
17
+ """)
18
+
19
+ # Input Dimensions of Wall
20
+ st.subheader("Wall Dimensions")
21
+ wall_height = st.number_input("Wall Height (meters):", min_value=0.1, step=0.1, format="%.2f")
22
+ wall_length = st.number_input("Wall Length (meters):", min_value=0.1, step=0.1, format="%.2f")
23
+ wall_thickness = st.number_input("Wall Thickness (meters):", min_value=0.1, step=0.1, format="%.2f")
24
+
25
+ # Input Dimensions of Brick
26
+ st.subheader("Brick Dimensions")
27
+ brick_height = st.number_input("Brick Height (meters):", min_value=0.01, step=0.01, format="%.3f")
28
+ brick_length = st.number_input("Brick Length (meters):", min_value=0.01, step=0.01, format="%.3f")
29
+ brick_width = st.number_input("Brick Width (meters):", min_value=0.01, step=0.01, format="%.3f")
30
+
31
+ # Estimate Button
32
+ if st.button("Estimate Requirements"):
33
+ # Validate Inputs
34
+ if wall_height <= 0 or wall_length <= 0 or wall_thickness <= 0:
35
+ st.error("Wall dimensions must be greater than zero!")
36
+ elif brick_height <= 0 or brick_length <= 0 or brick_width <= 0:
37
+ st.error("Brick dimensions must be greater than zero!")
38
+ else:
39
+ # Calculate volumes
40
+ wall_volume = wall_height * wall_length * wall_thickness
41
+ brick_volume = brick_height * brick_length * brick_width
42
+
43
+ # Calculate number of bricks and mortar volume
44
+ if brick_volume > 0:
45
+ num_bricks = wall_volume / brick_volume
46
+ mortar_volume = wall_volume * 0.2 # Assume 20% of wall volume is mortar
47
+
48
+ # Display Results
49
+ st.subheader("Results")
50
+ st.write(f"**Number of Bricks Required:** {int(num_bricks)} bricks")
51
+ st.write(f"**Mortar Volume Required:** {mortar_volume:.2f} cubic meters")
52
+ else:
53
+ st.error("Brick dimensions must form a valid volume!")
54
+
55
+ # Reset Inputs Button
56
+ if st.button("Clear Inputs"):
57
+ st.experimental_rerun()
58
+
59
+ # Footer
60
+ st.write("---")
61
+ st.markdown("💡 **Developed by Abdullah**")