Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import math
|
3 |
+
|
4 |
+
# Application title
|
5 |
+
st.title("Pipe Size Calculator")
|
6 |
+
|
7 |
+
# Input fields for flow rate and velocity
|
8 |
+
flow_rate = st.number_input("Enter flow rate (m³/s):", min_value=0.0, step=0.01, format="%.2f")
|
9 |
+
velocity = st.number_input("Enter velocity (m/s):", min_value=0.0, step=0.01, format="%.2f")
|
10 |
+
|
11 |
+
# Calculate and display the recommended pipe diameter
|
12 |
+
if flow_rate > 0 and velocity > 0:
|
13 |
+
# Calculate pipe diameter in meters
|
14 |
+
diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity))
|
15 |
+
|
16 |
+
# Convert diameter to centimeters for better readability
|
17 |
+
diameter_cm = diameter * 100
|
18 |
+
st.success(f"Recommended Pipe Diameter: {diameter:.4f} meters ({diameter_cm:.2f} cm)")
|
19 |
+
else:
|
20 |
+
st.warning("Please enter valid positive values for both flow rate and velocity.")
|