bhagwandas commited on
Commit
af70590
Β·
verified Β·
1 Parent(s): 17cff0e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +92 -0
app.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import streamlit as st
3
+ import math
4
+ import matplotlib.pyplot as plt
5
+
6
+ # Page Configuration
7
+ st.set_page_config(
8
+ page_title="🧱 Brick Masonry Estimator",
9
+ page_icon="πŸ—οΈ",
10
+ layout="centered"
11
+ )
12
+
13
+ # Custom CSS for Styling
14
+ st.markdown("""
15
+ <style>
16
+ .title {
17
+ text-align: center;
18
+ font-size: 2.5em;
19
+ font-weight: bold;
20
+ color: #FF5733;
21
+ }
22
+ .subtitle {
23
+ text-align: center;
24
+ font-size: 1.2em;
25
+ color: #555;
26
+ }
27
+ .result {
28
+ text-align: center;
29
+ font-size: 1.3em;
30
+ font-weight: bold;
31
+ color: #2196F3;
32
+ margin-top: 20px;
33
+ }
34
+ .footer {
35
+ text-align: center;
36
+ margin-top: 50px;
37
+ font-size: 0.9em;
38
+ color: #777;
39
+ }
40
+ .icon {
41
+ text-align: center;
42
+ font-size: 4em;
43
+ color: #FF9800;
44
+ }
45
+ </style>
46
+ """, unsafe_allow_html=True)
47
+
48
+ # Header with Icon
49
+ st.markdown("<div class='icon'>πŸ—οΈ</div>", unsafe_allow_html=True)
50
+ st.markdown("<h1 class='title'>🧱 Brick Masonry Estimator</h1>", unsafe_allow_html=True)
51
+ st.markdown("<p class='subtitle'>Calculate bricks and mortar required for a wall</p>", unsafe_allow_html=True)
52
+
53
+ # User Inputs
54
+ st.subheader("πŸ“ Wall Dimensions")
55
+ wall_length = st.number_input("πŸ“ Wall Length (m):", min_value=0.1, value=5.0)
56
+ wall_height = st.number_input("πŸ“ Wall Height (m):", min_value=0.1, value=3.0)
57
+ wall_thickness = st.number_input("🧱 Wall Thickness (m):", min_value=0.05, value=0.1)
58
+
59
+ st.subheader("🧱 Brick Dimensions")
60
+ brick_length = st.number_input("πŸ“ Brick Length (m):", min_value=0.05, value=0.2)
61
+ brick_height = st.number_input("πŸ“ Brick Height (m):", min_value=0.05, value=0.1)
62
+ brick_width = st.number_input("🧱 Brick Width (m):", min_value=0.05, value=0.1)
63
+
64
+ mortar_thickness = st.number_input("βš’οΈ Mortar Thickness (m):", min_value=0.005, value=0.01)
65
+
66
+ # Calculation Button
67
+ if st.button("πŸ”„ Calculate Bricks and Mortar"):
68
+ # Calculate Wall Volume
69
+ wall_volume = wall_length * wall_height * wall_thickness
70
+
71
+ # Calculate Brick Volume (Including Mortar)
72
+ brick_volume = (brick_length + mortar_thickness) * (brick_height + mortar_thickness) * (brick_width + mortar_thickness)
73
+
74
+ # Calculate Number of Bricks
75
+ num_bricks = wall_volume / brick_volume
76
+
77
+ # Calculate Mortar Volume
78
+ mortar_volume = wall_volume - (num_bricks * (brick_length * brick_height * brick_width))
79
+
80
+ st.markdown(f"<p class='result'>🧱 Total Number of Bricks: {math.ceil(num_bricks)} bricks</p>", unsafe_allow_html=True)
81
+ st.markdown(f"<p class='result'>βš’οΈ Total Mortar Volume: {mortar_volume:.2f} mΒ³</p>", unsafe_allow_html=True)
82
+
83
+ # Visualization
84
+ st.subheader("πŸ“Š Wall Dimension Visualization")
85
+ fig, ax = plt.subplots(figsize=(6, 4))
86
+ ax.barh(["Wall Volume", "Brick Volume", "Mortar Volume"], [wall_volume, brick_volume * num_bricks, mortar_volume], color=['skyblue', 'orange', 'green'])
87
+ ax.set_xlabel("Volume (mΒ³)")
88
+ ax.set_title("Volume Breakdown")
89
+ st.pyplot(fig)
90
+
91
+ # Footer
92
+ st.markdown("<p class='footer'>πŸ’» <b>Developed by ChatGPT</b></p>", unsafe_allow_html=True)