AyeshaAslam's picture
Update app.py
1c578f7 verified
import streamlit as st
# Title and description
st.title("Brick Masonry Estimator")
st.write("""
This application estimates the number of bricks required for a given wall size and the mortar required.
Enter the wall dimensions and brick size to calculate the total number of bricks and mortar volume.
""")
st.image("Silicon Valley.png", caption="This is an example image.", use_column_width=True)
# Input fields for wall and brick dimensions
wall_length = st.number_input("Enter the length of the wall (in meters):", min_value=0.0, step=0.1, format="%.2f")
wall_height = st.number_input("Enter the height of the wall (in meters):", min_value=0.0, step=0.1, format="%.2f")
brick_length = st.number_input("Enter the length of a brick (in meters):", min_value=0.0, step=0.01, format="%.2f")
brick_width = st.number_input("Enter the width of a brick (in meters):", min_value=0.0, step=0.01, format="%.2f")
brick_height = st.number_input("Enter the height of a brick (in meters):", min_value=0.0, step=0.01, format="%.2f")
# Calculate number of bricks and mortar
if st.button("Calculate"):
if wall_length > 0 and wall_height > 0 and brick_length > 0 and brick_width > 0 and brick_height > 0:
# Calculate the volume of the wall
wall_volume = wall_length * wall_height * 0.1 # Assuming wall thickness = 0.1 meters
# Calculate the volume of a single brick
brick_volume = brick_length * brick_width * brick_height
# Calculate number of bricks
num_bricks = wall_volume / brick_volume
# Calculate mortar volume (10% of the total volume)
mortar_volume = wall_volume * 0.1
st.success(f"Total number of bricks required: {int(num_bricks)}")
st.success(f"Total mortar volume required: {mortar_volume:.2f} cubic meters")
else:
st.error("Please enter positive values for all dimensions.")