Mtkhang90 commited on
Commit
103c6a1
·
verified ·
1 Parent(s): 15daf22

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -18
app.py CHANGED
@@ -1,30 +1,71 @@
1
  import streamlit as st
2
 
3
- st.set_page_config(page_title="House Material Estimator", page_icon="🏠", layout="centered")
4
 
5
- st.title("🏠 House Material Estimator")
6
- st.write("Get a rough estimate of building materials based on house size.")
7
 
8
- # Input
9
  house_area = st.number_input('Enter the total house area (in square feet)', min_value=100)
 
 
 
 
10
 
11
- # Default material requirements (per 1000 sq ft)
12
  material_ratios = {
13
- "Bricks (units)": 8000,
14
- "Cement (bags)": 400,
15
- "Sand (tons)": 15,
16
- "Steel (tons)": 5,
17
- "Gravel (tons)": 20,
18
- "Wood (cubic feet)": 500
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
 
21
- if st.button('Estimate Materials'):
22
- st.subheader("Estimated Materials Needed:")
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- factor = house_area / 1000 # since ratios are per 1000 sq ft
25
-
26
- for material, base_amount in material_ratios.items():
27
  required = base_amount * factor
28
- st.write(f"- **{material}**: {required:.2f}")
 
 
 
 
 
 
 
 
 
29
 
30
- st.info("⚡ This is a rough estimate. Actual requirements may vary based on design and local conditions.")
 
1
  import streamlit as st
2
 
3
+ st.set_page_config(page_title="🏠 House Material & Cost Estimator", page_icon="🛠", layout="centered")
4
 
5
+ st.title("🏠 House Material & Cost Estimator")
6
+ st.write("Plan your building project with estimated materials and cost.")
7
 
8
+ # Inputs
9
  house_area = st.number_input('Enter the total house area (in square feet)', min_value=100)
10
+ house_type = st.selectbox(
11
+ 'Select the house type',
12
+ ('Single Story', 'Double Story', 'Luxury')
13
+ )
14
 
15
+ # Material ratios based on house type (per 1000 sq ft)
16
  material_ratios = {
17
+ "Single Story": {
18
+ "Bricks (units)": 8000,
19
+ "Cement (bags)": 400,
20
+ "Sand (tons)": 15,
21
+ "Steel (tons)": 5,
22
+ "Gravel (tons)": 20,
23
+ "Wood (cubic feet)": 500
24
+ },
25
+ "Double Story": {
26
+ "Bricks (units)": 12000,
27
+ "Cement (bags)": 600,
28
+ "Sand (tons)": 22,
29
+ "Steel (tons)": 8,
30
+ "Gravel (tons)": 30,
31
+ "Wood (cubic feet)": 700
32
+ },
33
+ "Luxury": {
34
+ "Bricks (units)": 10000,
35
+ "Cement (bags)": 500,
36
+ "Sand (tons)": 20,
37
+ "Steel (tons)": 7,
38
+ "Gravel (tons)": 25,
39
+ "Wood (cubic feet)": 1000
40
+ }
41
  }
42
 
43
+ # Basic cost estimates (example rates)
44
+ cost_per_unit = {
45
+ "Bricks (units)": 10, # per brick
46
+ "Cement (bags)": 8, # per bag
47
+ "Sand (tons)": 50, # per ton
48
+ "Steel (tons)": 700, # per ton
49
+ "Gravel (tons)": 40, # per ton
50
+ "Wood (cubic feet)": 15 # per cubic foot
51
+ }
52
+
53
+ if st.button('Estimate Materials and Cost'):
54
+ st.subheader("📦 Estimated Materials Needed:")
55
+
56
+ factor = house_area / 1000
57
+ total_cost = 0
58
 
59
+ for material, base_amount in material_ratios[house_type].items():
 
 
60
  required = base_amount * factor
61
+ cost = required * cost_per_unit[material]
62
+ total_cost += cost
63
+
64
+ st.write(f"- **{material}**: {required:.2f} (Cost: ${cost:,.2f})")
65
+
66
+ st.subheader(f"💰 Total Estimated Cost: **${total_cost:,.2f}**")
67
+ st.info("⚡ This is a rough estimate. Actual requirements and prices may vary based on location and design.")
68
+
69
+ st.markdown("---")
70
+ st.caption("Built with ❤️ using Streamlit")
71