Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
import streamlit as st
|
3 |
import math
|
4 |
|
5 |
-
# Page Configuration
|
6 |
st.set_page_config(
|
7 |
page_title="π§ Pipe Sizing Helper",
|
8 |
page_icon="π§",
|
@@ -28,6 +28,7 @@ st.markdown("""
|
|
28 |
font-size: 1.3em;
|
29 |
font-weight: bold;
|
30 |
color: #2196F3;
|
|
|
31 |
}
|
32 |
.footer {
|
33 |
text-align: center;
|
@@ -35,27 +36,38 @@ st.markdown("""
|
|
35 |
font-size: 0.9em;
|
36 |
color: #777;
|
37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
</style>
|
39 |
""", unsafe_allow_html=True)
|
40 |
|
41 |
-
# Header
|
|
|
42 |
st.markdown("<h1 class='title'>π§ Pipe Sizing Helper</h1>", unsafe_allow_html=True)
|
43 |
st.markdown("<p class='subtitle'>Calculate optimal pipe size based on flow rate and velocity</p>", unsafe_allow_html=True)
|
44 |
|
45 |
# User Inputs
|
46 |
st.subheader("π‘ Input Parameters")
|
47 |
-
|
48 |
flow_rate = st.number_input("π Enter Flow Rate (mΒ³/s):", min_value=0.0, format="%.4f")
|
49 |
velocity = st.number_input("π¨ Enter Permissible Velocity (m/s):", min_value=0.1, format="%.2f")
|
50 |
|
51 |
-
#
|
52 |
-
|
|
|
53 |
if velocity > 0 and flow_rate > 0:
|
54 |
# Formula: Diameter = sqrt((4 * Flow Rate) / (Ο * Velocity))
|
55 |
diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity))
|
56 |
st.markdown(f"<p class='result'>β
Recommended Pipe Diameter: {diameter:.2f} meters</p>", unsafe_allow_html=True)
|
57 |
else:
|
58 |
st.warning("β οΈ Please enter valid positive values for flow rate and velocity.")
|
|
|
59 |
|
60 |
# Footer
|
61 |
st.markdown("<p class='footer'>π» <b>Developed by ChatGPT</b></p>", unsafe_allow_html=True)
|
|
|
2 |
import streamlit as st
|
3 |
import math
|
4 |
|
5 |
+
# Page Configuration with Icon
|
6 |
st.set_page_config(
|
7 |
page_title="π§ Pipe Sizing Helper",
|
8 |
page_icon="π§",
|
|
|
28 |
font-size: 1.3em;
|
29 |
font-weight: bold;
|
30 |
color: #2196F3;
|
31 |
+
margin-top: 20px;
|
32 |
}
|
33 |
.footer {
|
34 |
text-align: center;
|
|
|
36 |
font-size: 0.9em;
|
37 |
color: #777;
|
38 |
}
|
39 |
+
.icon {
|
40 |
+
text-align: center;
|
41 |
+
font-size: 4em;
|
42 |
+
color: #FF9800;
|
43 |
+
}
|
44 |
+
.button {
|
45 |
+
text-align: center;
|
46 |
+
margin-top: 30px;
|
47 |
+
}
|
48 |
</style>
|
49 |
""", unsafe_allow_html=True)
|
50 |
|
51 |
+
# Header with Icon
|
52 |
+
st.markdown("<div class='icon'>π§</div>", unsafe_allow_html=True)
|
53 |
st.markdown("<h1 class='title'>π§ Pipe Sizing Helper</h1>", unsafe_allow_html=True)
|
54 |
st.markdown("<p class='subtitle'>Calculate optimal pipe size based on flow rate and velocity</p>", unsafe_allow_html=True)
|
55 |
|
56 |
# User Inputs
|
57 |
st.subheader("π‘ Input Parameters")
|
|
|
58 |
flow_rate = st.number_input("π Enter Flow Rate (mΒ³/s):", min_value=0.0, format="%.4f")
|
59 |
velocity = st.number_input("π¨ Enter Permissible Velocity (m/s):", min_value=0.1, format="%.2f")
|
60 |
|
61 |
+
# Button for Calculation
|
62 |
+
st.markdown("<div class='button'>", unsafe_allow_html=True)
|
63 |
+
if st.button("π Generate Pipe Diameter"):
|
64 |
if velocity > 0 and flow_rate > 0:
|
65 |
# Formula: Diameter = sqrt((4 * Flow Rate) / (Ο * Velocity))
|
66 |
diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity))
|
67 |
st.markdown(f"<p class='result'>β
Recommended Pipe Diameter: {diameter:.2f} meters</p>", unsafe_allow_html=True)
|
68 |
else:
|
69 |
st.warning("β οΈ Please enter valid positive values for flow rate and velocity.")
|
70 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
71 |
|
72 |
# Footer
|
73 |
st.markdown("<p class='footer'>π» <b>Developed by ChatGPT</b></p>", unsafe_allow_html=True)
|