CoolFace
Apppublic

Cv107/Open_Channel_Helper

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
app.py40 linesDownload Raw Back to root
1import streamlit as st2 3def calculate_open_channel(flow_rate, velocity):4    """5    Calculate the cross-sectional area of an open channel.6    :param flow_rate: Flow rate (Q) in cubic meters per second (m^3/s)7    :param velocity: Permissible velocity (V) in meters per second (m/s)8    :return: Cross-sectional area in square meters (m^2)9    """10    if velocity <= 0:11        return None, "Velocity must be greater than 0."12    try:13        cross_section = flow_rate / velocity14        return cross_section, None15    except Exception as e:16        return None, str(e)17 18# Streamlit UI19st.title("Open Channel Helper for 500 Acre Barren Land")20st.markdown(21    "This tool calculates the recommended open channel cross-section for a given flow rate and permissible velocity."22)23 24# Input fields25flow_rate = st.number_input(26    "Enter Flow Rate (m³/s):", min_value=0.0, step=0.01, format="%.2f"27)28velocity = st.number_input(29    "Enter Permissible Velocity (m/s):", min_value=0.0, step=0.01, format="%.2f"30)31 32# Perform calculation33if st.button("Calculate Open Channel Cross-Section"):34    cross_section, error = calculate_open_channel(flow_rate, velocity)35    if error:36        st.error(error)37    else:38        st.success(f"Recommended Open Channel Cross-Section: {cross_section:.4f} m²")39 40