Py.Cafe

McGinty666/

pycafe-streamlit-examples-showcase

Py.cafe: Streamlit Examples Showcase

DocsPricing
  • app.py
  • requirements.txt
  • test
  • test4
  • test_app
test4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import import streamlit as st
import math

# Title of the app
st.title("Pipe Volume Calculator")

# Input fields for dimensions
inner_diameter = st.number_input("Enter the inner diameter of the pipe (in meters):", min_value=0.0, format="%.2f")
outer_diameter = st.number_input("Enter the outer diameter of the pipe (in meters):", min_value=0.0, format="%.2f")
length = st.number_input("Enter the length of the pipe (in meters):", min_value=0.0, format="%.2f")

# Calculate the volume
if st.button("Calculate Volume"):
    if inner_diameter > 0 and outer_diameter > 0 and length > 0:
        inner_radius = inner_diameter / 2
        outer_radius = outer_diameter / 2
        volume = math.pi * (outer_radius**2 - inner_radius**2) * length
        st.success(f"The volume of the pipe is {volume:.2f} cubic meters.")
    else:
        st.error("Please enter valid dimensions greater than zero.")streamlit as st
import math

# Title of the app
st.title("Pipe Volume Calculator")

# Input fields for dimensions
inner_diameter = st.number_input("Enter the inner diameter of the pipe (in meters):", min_value=0.0, format="%.2f")
outer_diameter = st.number_input("Enter the outer diameter of the pipe (in meters):", min_value=0.0, format="%.2f")
length = st.number_input("Enter the length of the pipe (in meters):", min_value=0.0, format="%.2f")

# Calculate the volume
if st.button("Calculate Volume"):
    if inner_diameter > 0 and outer_diameter > 0 and length > 0:
        inner_radius = inner_diameter / 2
        outer_radius = outer_diameter / 2
        volume = math.pi * (outer_radius**2 - inner_radius**2) * length
        st.success(f"The volume of the pipe is {volume:.2f} cubic meters.")
    else:
        st.error("Please enter valid dimensions greater than zero.")