Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,26 +7,75 @@ import streamlit as st
|
|
| 7 |
# import pandas
|
| 8 |
import pandas as pd
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# define functiom which can provide formatted input with appropriate label and input text
|
| 11 |
# this will help in p[roducing consistent representation
|
| 12 |
-
def
|
| 13 |
st.markdown(f"**{title}**")
|
| 14 |
st.caption(hint)
|
| 15 |
return st.number_input("", **kwargs)
|
| 16 |
|
| 17 |
-
def
|
| 18 |
|
| 19 |
st.markdown('<div style="margin-bottom:4px;">', unsafe_allow_html=True)
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
return user_input
|
| 31 |
|
| 32 |
# ---------------------------------------------------------
|
|
@@ -38,16 +87,6 @@ st.set_page_config(
|
|
| 38 |
)
|
| 39 |
|
| 40 |
|
| 41 |
-
st.markdown("""
|
| 42 |
-
<style>
|
| 43 |
-
.block-container {
|
| 44 |
-
padding-top: 0.75rem;
|
| 45 |
-
padding-bottom: 0.75rem;
|
| 46 |
-
}
|
| 47 |
-
</style>
|
| 48 |
-
""", unsafe_allow_html=True)
|
| 49 |
-
|
| 50 |
-
|
| 51 |
# ---------------------------------------------------------
|
| 52 |
# TITLE
|
| 53 |
# ---------------------------------------------------------
|
|
@@ -77,7 +116,7 @@ col_left, col_right = st.columns([1,1])
|
|
| 77 |
|
| 78 |
with col_left:
|
| 79 |
|
| 80 |
-
rpm =
|
| 81 |
"Lubricating oil pressure in kilopascals (kPa)",
|
| 82 |
"50 to 2500",
|
| 83 |
minval=50.0,
|
|
@@ -88,7 +127,7 @@ with col_left:
|
|
| 88 |
)
|
| 89 |
|
| 90 |
|
| 91 |
-
oil_pressure =
|
| 92 |
"Lubricating oil pressure in kilopascals (kPa)",
|
| 93 |
"0.001 to 10.0",
|
| 94 |
minval=0.001,
|
|
@@ -99,7 +138,7 @@ with col_left:
|
|
| 99 |
)
|
| 100 |
|
| 101 |
|
| 102 |
-
fuel_pressure =
|
| 103 |
"Fuel Pressure in kilopascals (kPa)",
|
| 104 |
"0.01 to 25.0",
|
| 105 |
minval=0.01,
|
|
@@ -110,7 +149,7 @@ with col_left:
|
|
| 110 |
)
|
| 111 |
|
| 112 |
with col_right:
|
| 113 |
-
coolant_pressure =
|
| 114 |
"Coolant Pressure in kilopascals (kPa)",
|
| 115 |
"0.01 to 10.0",
|
| 116 |
minval=0.01,
|
|
@@ -121,7 +160,7 @@ with col_right:
|
|
| 121 |
)
|
| 122 |
|
| 123 |
|
| 124 |
-
lub_oil_temp =
|
| 125 |
"Lubricating oil Temperature in degrees Celsius (°C)",
|
| 126 |
"50.0 to 100.0",
|
| 127 |
minval=50.0,
|
|
@@ -132,7 +171,7 @@ with col_right:
|
|
| 132 |
)
|
| 133 |
|
| 134 |
|
| 135 |
-
coolant_temp =
|
| 136 |
"Coolant Temperature in degrees Celsius (°C)",
|
| 137 |
"50.0 to 200.0",
|
| 138 |
minval=50.0,
|
|
|
|
| 7 |
# import pandas
|
| 8 |
import pandas as pd
|
| 9 |
|
| 10 |
+
st.markdown("""
|
| 11 |
+
<style>
|
| 12 |
+
.block-container {
|
| 13 |
+
padding-top: 0.75rem;
|
| 14 |
+
padding-bottom: 0.75rem;
|
| 15 |
+
}
|
| 16 |
+
</style>
|
| 17 |
+
""", unsafe_allow_html=True)
|
| 18 |
+
|
| 19 |
+
# Hide +/- buttons and reduce input size
|
| 20 |
+
st.markdown("""
|
| 21 |
+
<style>
|
| 22 |
+
|
| 23 |
+
/* Hide step buttons */
|
| 24 |
+
input[type=number]::-webkit-inner-spin-button,
|
| 25 |
+
input[type=number]::-webkit-outer-spin-button {
|
| 26 |
+
-webkit-appearance: none;
|
| 27 |
+
margin: 0;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
input[type=number] {
|
| 31 |
+
-moz-appearance: textfield;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/* Reduce input box height and padding */
|
| 35 |
+
.stNumberInput input {
|
| 36 |
+
height: 32px;
|
| 37 |
+
padding: 4px 8px;
|
| 38 |
+
font-size: 14px;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* Reduce vertical spacing */
|
| 42 |
+
div[data-baseweb="input"] {
|
| 43 |
+
margin-bottom: -10px;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
</style>
|
| 47 |
+
""", unsafe_allow_html=True)
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
|
| 51 |
# define functiom which can provide formatted input with appropriate label and input text
|
| 52 |
# this will help in p[roducing consistent representation
|
| 53 |
+
def formatted_number_input_variable_arg(title, hint, **kwargs):
|
| 54 |
st.markdown(f"**{title}**")
|
| 55 |
st.caption(hint)
|
| 56 |
return st.number_input("", **kwargs)
|
| 57 |
|
| 58 |
+
def formatted_number_input(title, hint, minval, maxval, defvalue, steps, valformat="%.6f"):
|
| 59 |
|
| 60 |
st.markdown('<div style="margin-bottom:4px;">', unsafe_allow_html=True)
|
| 61 |
|
| 62 |
+
col1, col2 = st.columns([2,1]) # label wider, input smaller
|
| 63 |
+
|
| 64 |
+
with col1:
|
| 65 |
+
st.markdown(f"**{title}**")
|
| 66 |
+
st.caption(hint)
|
| 67 |
+
|
| 68 |
+
with col2:
|
| 69 |
+
user_input = st.number_input(
|
| 70 |
+
label="",
|
| 71 |
+
min_value=minval,
|
| 72 |
+
max_value=maxval,
|
| 73 |
+
value=defvalue,
|
| 74 |
+
step=step,
|
| 75 |
+
format=format,
|
| 76 |
+
label_visibility="collapsed"
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
return user_input
|
| 80 |
|
| 81 |
# ---------------------------------------------------------
|
|
|
|
| 87 |
)
|
| 88 |
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
# ---------------------------------------------------------
|
| 91 |
# TITLE
|
| 92 |
# ---------------------------------------------------------
|
|
|
|
| 116 |
|
| 117 |
with col_left:
|
| 118 |
|
| 119 |
+
rpm = formatted_number_input(
|
| 120 |
"Lubricating oil pressure in kilopascals (kPa)",
|
| 121 |
"50 to 2500",
|
| 122 |
minval=50.0,
|
|
|
|
| 127 |
)
|
| 128 |
|
| 129 |
|
| 130 |
+
oil_pressure = formatted_number_input(
|
| 131 |
"Lubricating oil pressure in kilopascals (kPa)",
|
| 132 |
"0.001 to 10.0",
|
| 133 |
minval=0.001,
|
|
|
|
| 138 |
)
|
| 139 |
|
| 140 |
|
| 141 |
+
fuel_pressure = formatted_number_input(
|
| 142 |
"Fuel Pressure in kilopascals (kPa)",
|
| 143 |
"0.01 to 25.0",
|
| 144 |
minval=0.01,
|
|
|
|
| 149 |
)
|
| 150 |
|
| 151 |
with col_right:
|
| 152 |
+
coolant_pressure = formatted_number_input(
|
| 153 |
"Coolant Pressure in kilopascals (kPa)",
|
| 154 |
"0.01 to 10.0",
|
| 155 |
minval=0.01,
|
|
|
|
| 160 |
)
|
| 161 |
|
| 162 |
|
| 163 |
+
lub_oil_temp = formatted_number_input(
|
| 164 |
"Lubricating oil Temperature in degrees Celsius (°C)",
|
| 165 |
"50.0 to 100.0",
|
| 166 |
minval=50.0,
|
|
|
|
| 171 |
)
|
| 172 |
|
| 173 |
|
| 174 |
+
coolant_temp = formatted_number_input(
|
| 175 |
"Coolant Temperature in degrees Celsius (°C)",
|
| 176 |
"50.0 to 200.0",
|
| 177 |
minval=50.0,
|