AyeshaAslam commited on
Commit
6e9ef7f
·
verified ·
1 Parent(s): 3e2f286

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -11,18 +11,36 @@ def calculate_diameter(flow_rate, velocity):
11
 
12
  # Streamlit App
13
  def main():
14
- st.title("Pipe Sizing Helper")
 
 
 
 
 
 
 
 
 
15
 
16
  # Input fields for flow rate and velocity
17
  flow_rate = st.number_input("Enter Flow Rate (m³/s):", min_value=0.0, step=0.01)
18
  velocity = st.number_input("Enter Permissible Velocity (m/s):", min_value=0.0, step=0.1)
 
 
 
 
 
 
 
 
 
19
 
20
- # Calculate and display recommended pipe diameter
21
- if flow_rate > 0 and velocity > 0:
22
- diameter = calculate_diameter(flow_rate, velocity)
23
- st.write(f"The recommended pipe diameter is: {diameter:.2f} meters")
24
- else:
25
- st.write("Please enter valid values for flow rate and velocity.")
26
 
27
  if __name__ == "__main__":
28
  main()
 
11
 
12
  # Streamlit App
13
  def main():
14
+ # Set the page configuration with a title, icon, and layout style
15
+ st.set_page_config(
16
+ page_title="Pipe Sizing Helper",
17
+ page_icon="💧", # Water-related icon
18
+ layout="centered", # Center the content
19
+ )
20
+
21
+ # Title and description
22
+ st.title("Pipe Sizing Helper 💧")
23
+ st.markdown("Enter the flow rate and permissible velocity to get the recommended pipe diameter.")
24
 
25
  # Input fields for flow rate and velocity
26
  flow_rate = st.number_input("Enter Flow Rate (m³/s):", min_value=0.0, step=0.01)
27
  velocity = st.number_input("Enter Permissible Velocity (m/s):", min_value=0.0, step=0.1)
28
+
29
+ # Create a button to calculate the recommended pipe diameter
30
+ if st.button("Generate Pipe Diameter"):
31
+ # Check if both flow rate and velocity are greater than zero
32
+ if flow_rate > 0 and velocity > 0:
33
+ diameter = calculate_diameter(flow_rate, velocity)
34
+ st.write(f"The recommended pipe diameter is: **{diameter:.2f} meters**")
35
+ else:
36
+ st.error("Please enter valid values for flow rate and velocity.")
37
 
38
+ # Add some helpful info or tips
39
+ st.markdown("""
40
+ ### Tips:
41
+ - Flow rate (Q) is the volume of fluid passing through the pipe per unit of time (in cubic meters per second).
42
+ - Permissible velocity (v) is the maximum allowable speed of the fluid inside the pipe (in meters per second).
43
+ """)
44
 
45
  if __name__ == "__main__":
46
  main()