pipesizehelper / app.py
TANVEERMAKHDOOM's picture
Update app.py
2184b09 verified
import streamlit as st
import math
st.set_page_config(page_title="Paper Size Helper", page_icon="πŸ“„", layout="centered")
# --- Header ---
st.title("πŸ“„ Paper Size Helper")
st.markdown("### πŸ” Find the Ideal Paper Tube Diameter")
st.write("Enter the flow rate and velocity to calculate the required diameter for paper rolls.")
# --- Input Section ---
st.markdown("#### ✏️ Input Parameters")
col1, col2 = st.columns(2)
with col1:
flow_rate = st.number_input("Flow Rate (mΒ³/s)", min_value=1, step=1)
with col2:
velocity = st.number_input("Velocity (m/s)", min_value=1, step=1)
# --- Calculation and Output ---
st.markdown("---")
st.markdown("#### πŸ“ Result")
if flow_rate > 0 and velocity > 0:
area = flow_rate / velocity
diameter = math.sqrt((4 * area) / math.pi)
diameter_rounded = round(diameter)
st.success(f"Recommended Diameter: **{diameter_rounded} meters**")
else:
st.info("Please enter values greater than zero for both flow rate and velocity.")
# --- Footer ---
st.markdown("---")
st.caption("🧠 Formula used: D = sqrt((4 Γ— Q) / (Ο€ Γ— V))")