Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,6 @@ Use the sidebar to select tasks and input parameters.
|
|
23 |
|
24 |
# Sidebar for User Input
|
25 |
st.sidebar.title("User Input")
|
26 |
-
st.sidebar.image("https://example.com/hvac_image.png", use_column_width=True) # Replace with a relevant HVAC image URL
|
27 |
task = st.sidebar.selectbox("Choose a Task", [
|
28 |
"CFM to Ton Conversion",
|
29 |
"Heat Load Calculation",
|
@@ -49,4 +48,61 @@ def recommend_system(heat_load):
|
|
49 |
return "EAU (Evaporative Air Unit)", "120,001+ BTU"
|
50 |
|
51 |
def calculate_ac_units(heat_load, capacity_per_unit):
|
52 |
-
return int((heat_load /
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
# Sidebar for User Input
|
25 |
st.sidebar.title("User Input")
|
|
|
26 |
task = st.sidebar.selectbox("Choose a Task", [
|
27 |
"CFM to Ton Conversion",
|
28 |
"Heat Load Calculation",
|
|
|
48 |
return "EAU (Evaporative Air Unit)", "120,001+ BTU"
|
49 |
|
50 |
def calculate_ac_units(heat_load, capacity_per_unit):
|
51 |
+
return int((heat_load / capacity_per_unit) + 0.5)
|
52 |
+
|
53 |
+
# Task-specific logic
|
54 |
+
if task == "CFM to Ton Conversion":
|
55 |
+
st.header("CFM to Ton Conversion")
|
56 |
+
cfm = st.number_input("Enter CFM (Cubic Feet per Minute)", min_value=0.0, step=1.0)
|
57 |
+
if st.button("Convert"):
|
58 |
+
if cfm:
|
59 |
+
tons = cfm_to_ton(cfm)
|
60 |
+
st.success(f"Equivalent Tons: {tons:.2f}")
|
61 |
+
|
62 |
+
elif task == "Heat Load Calculation":
|
63 |
+
st.header("Heat Load Calculation")
|
64 |
+
col1, col2 = st.columns(2)
|
65 |
+
with col1:
|
66 |
+
area = st.number_input("Enter Area", min_value=0.0, step=1.0)
|
67 |
+
area_unit = st.selectbox("Area Unit", ["sq ft", "sq m", "sq cm", "sq mm"])
|
68 |
+
with col2:
|
69 |
+
occupants = st.number_input("Number of Occupants", min_value=0, step=1)
|
70 |
+
appliances = st.number_input("Appliances Heat Load (in BTU)", min_value=0.0, step=100.0)
|
71 |
+
|
72 |
+
if st.button("Calculate Heat Load"):
|
73 |
+
# Convert area to square feet if needed
|
74 |
+
if area_unit == "sq m":
|
75 |
+
area *= 10.764
|
76 |
+
elif area_unit == "sq cm":
|
77 |
+
area /= 929.03
|
78 |
+
elif area_unit == "sq mm":
|
79 |
+
area /= 92903.04
|
80 |
+
|
81 |
+
heat_load = calculate_heat_load(area, occupants, appliances)
|
82 |
+
st.success(f"Heat Load: {heat_load:.2f} BTU")
|
83 |
+
|
84 |
+
elif task == "System Selection":
|
85 |
+
st.header("System Selection")
|
86 |
+
heat_load = st.number_input("Enter Heat Load (in BTU)", min_value=0.0, step=100.0)
|
87 |
+
if st.button("Recommend System"):
|
88 |
+
if heat_load:
|
89 |
+
system, details = recommend_system(heat_load)
|
90 |
+
st.success(f"Recommended System: {system}")
|
91 |
+
st.info(f"Details: {details}")
|
92 |
+
|
93 |
+
elif task == "AC Unit Requirements":
|
94 |
+
st.header("AC Unit Requirements")
|
95 |
+
col1, col2 = st.columns(2)
|
96 |
+
with col1:
|
97 |
+
heat_load = st.number_input("Enter Total Heat Load (in BTU)", min_value=0.0, step=100.0)
|
98 |
+
with col2:
|
99 |
+
capacity_per_unit = st.number_input("Capacity per Unit (in BTU)", min_value=1000.0, step=100.0)
|
100 |
+
|
101 |
+
if st.button("Calculate Units"):
|
102 |
+
if heat_load and capacity_per_unit:
|
103 |
+
units_required = calculate_ac_units(heat_load, capacity_per_unit)
|
104 |
+
st.success(f"Number of AC Units Required: {units_required}")
|
105 |
+
|
106 |
+
# Add Footer
|
107 |
+
st.markdown("---")
|
108 |
+
st.markdown("Built with ❤️ using Streamlit")
|