# app.py import streamlit as st import math # Page Configuration with Icon st.set_page_config( page_title="🔧 Pipe Sizing Helper", page_icon="💧", layout="centered" ) # Custom CSS for Styling st.markdown(""" """, unsafe_allow_html=True) # Header with Icon st.markdown("
💧
", unsafe_allow_html=True) st.markdown("

🔧 Pipe Sizing Helper

", unsafe_allow_html=True) st.markdown("

Calculate optimal pipe size based on flow rate and velocity

", unsafe_allow_html=True) # User Inputs st.subheader("💡 Input Parameters") flow_rate = st.number_input("🌊 Enter Flow Rate (m³/s):", min_value=0.0, format="%.4f") velocity = st.number_input("💨 Enter Permissible Velocity (m/s):", min_value=0.1, format="%.2f") # Button for Calculation st.markdown("
", unsafe_allow_html=True) if st.button("🔄 Generate Pipe Diameter"): if velocity > 0 and flow_rate > 0: # Formula: Diameter = sqrt((4 * Flow Rate) / (π * Velocity)) diameter = math.sqrt((4 * flow_rate) / (math.pi * velocity)) st.markdown(f"

✅ Recommended Pipe Diameter: {diameter:.2f} meters

", unsafe_allow_html=True) else: st.warning("⚠️ Please enter valid positive values for flow rate and velocity.") st.markdown("
", unsafe_allow_html=True) # Footer st.markdown("", unsafe_allow_html=True)