Spaces:
Sleeping
Sleeping
AyeshaAslam
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import math
|
3 |
+
|
4 |
+
# Title and description
|
5 |
+
st.title("Pipe Sizing Helper")
|
6 |
+
st.write("This application helps you determine the recommended pipe diameter based on flow rate and velocity.")
|
7 |
+
|
8 |
+
# Input fields for flow rate and velocity
|
9 |
+
flow_rate = st.number_input("Enter the flow rate (in m³/s):", min_value=0.0, step=0.01, format="%.2f")
|
10 |
+
velocity = st.number_input("Enter the permissible velocity (in m/s):", min_value=0.0, step=0.1, format="%.1f")
|
11 |
+
|
12 |
+
# Calculate pipe diameter
|
13 |
+
if st.button("Calculate Pipe Diameter"):
|
14 |
+
if flow_rate > 0 and velocity > 0:
|
15 |
+
# Formula: Diameter (D) = sqrt((4 * Q) / (π * V))
|
16 |
+
diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity))
|
17 |
+
diameter_mm = diameter * 1000 # Convert to millimeters
|
18 |
+
st.success(f"The recommended pipe diameter is {diameter_mm:.2f} mm.")
|
19 |
+
else:
|
20 |
+
st.error("Please enter positive values for both flow rate and velocity.")
|