Upload streamlit_app.py
Browse files- src/streamlit_app.py +16 -23
src/streamlit_app.py
CHANGED
|
@@ -13,23 +13,23 @@ st.set_page_config(
|
|
| 13 |
initial_sidebar_state="collapsed"
|
| 14 |
)
|
| 15 |
|
| 16 |
-
# Custom CSS for
|
| 17 |
st.markdown("""
|
| 18 |
<style>
|
| 19 |
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
| 20 |
.main {background-color: #ffffff;}
|
| 21 |
-
.stTitle {
|
| 22 |
-
.stSubheader {
|
| 23 |
-
.stMarkdown {font-family: 'Roboto', sans-serif;
|
| 24 |
.stDataFrame {
|
| 25 |
background-color: #ffffff;
|
| 26 |
border-radius: 12px;
|
| 27 |
padding: 15px;
|
| 28 |
-
|
| 29 |
}
|
| 30 |
.stButton>button {
|
| 31 |
-
background-color: #
|
| 32 |
-
color:
|
| 33 |
border-radius: 10px;
|
| 34 |
padding: 12px 30px;
|
| 35 |
font-size: 18px;
|
|
@@ -37,34 +37,28 @@ st.markdown("""
|
|
| 37 |
font-weight: 700;
|
| 38 |
display: block;
|
| 39 |
margin: 15px auto;
|
| 40 |
-
border:
|
| 41 |
-
transition: all 0.3s ease;
|
| 42 |
}
|
| 43 |
.stButton>button:hover {
|
| 44 |
-
background:
|
| 45 |
-
transform: scale(1.05);
|
| 46 |
-
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
|
| 47 |
}
|
| 48 |
.stNumberInput label {
|
| 49 |
-
color: #007bff;
|
| 50 |
font-family: 'Roboto', sans-serif;
|
| 51 |
font-weight: 700;
|
| 52 |
font-size: 16px;
|
| 53 |
}
|
| 54 |
.stNumberInput input {
|
| 55 |
background-color: #ffffff;
|
| 56 |
-
color: #
|
| 57 |
-
border: 2px solid #
|
| 58 |
border-radius: 8px;
|
| 59 |
padding: 10px;
|
| 60 |
font-family: 'Roboto', sans-serif;
|
| 61 |
font-size: 14px;
|
| 62 |
-
caret-color: #212529;
|
| 63 |
}
|
| 64 |
.stNumberInput input:focus {
|
| 65 |
outline: none;
|
| 66 |
-
border
|
| 67 |
-
box-shadow: 0 0 8px rgba(0,123,255,0.3);
|
| 68 |
}
|
| 69 |
</style>
|
| 70 |
""", unsafe_allow_html=True)
|
|
@@ -108,7 +102,7 @@ except Exception as e:
|
|
| 108 |
st.title("Power Consumption Predictor")
|
| 109 |
st.markdown("""
|
| 110 |
Enter values for one timestep to predict power consumption for Zone1, Zone2, and Zone3.
|
| 111 |
-
Results will be displayed as a
|
| 112 |
""")
|
| 113 |
|
| 114 |
# Input section
|
|
@@ -186,14 +180,13 @@ if 'predictions' in st.session_state and st.session_state.predictions is not Non
|
|
| 186 |
st.session_state.pred_df.reset_index().melt(id_vars='index', value_vars=labels, var_name='Zone', value_name='Power Consumption'),
|
| 187 |
x='index', y='Power Consumption', color='Zone', barmode='group',
|
| 188 |
title='Predicted Power Consumption by Zone',
|
| 189 |
-
labels={'index': 'Sample', 'Power Consumption': 'Power Consumption (Original Scale)'}
|
| 190 |
-
color_discrete_sequence=['#007bff', '#28a745', '#dc3545']
|
| 191 |
)
|
| 192 |
fig.update_layout(
|
| 193 |
plot_bgcolor='white',
|
| 194 |
paper_bgcolor='white',
|
| 195 |
-
font=dict(family='Roboto', size=12
|
| 196 |
-
title_font=dict(size=18, family='Roboto'
|
| 197 |
xaxis_title="Sample",
|
| 198 |
yaxis_title="Power Consumption (Original Scale)",
|
| 199 |
legend_title="Zones",
|
|
|
|
| 13 |
initial_sidebar_state="collapsed"
|
| 14 |
)
|
| 15 |
|
| 16 |
+
# Custom CSS for white background and black text/borders
|
| 17 |
st.markdown("""
|
| 18 |
<style>
|
| 19 |
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
|
| 20 |
.main {background-color: #ffffff;}
|
| 21 |
+
.stTitle {font-family: 'Roboto', sans-serif; text-align: center; margin-bottom: 10px; font-size: 32px; font-weight: 700;}
|
| 22 |
+
.stSubheader {font-family: 'Roboto', sans-serif; font-size: 22px; font-weight: 700; margin-top: 10px; margin-bottom: 10px;}
|
| 23 |
+
.stMarkdown {font-family: 'Roboto', sans-serif; font-size: 16px;}
|
| 24 |
.stDataFrame {
|
| 25 |
background-color: #ffffff;
|
| 26 |
border-radius: 12px;
|
| 27 |
padding: 15px;
|
| 28 |
+
border: 1px solid #000000;
|
| 29 |
}
|
| 30 |
.stButton>button {
|
| 31 |
+
background-color: #ffffff;
|
| 32 |
+
color: #000000;
|
| 33 |
border-radius: 10px;
|
| 34 |
padding: 12px 30px;
|
| 35 |
font-size: 18px;
|
|
|
|
| 37 |
font-weight: 700;
|
| 38 |
display: block;
|
| 39 |
margin: 15px auto;
|
| 40 |
+
border: 2px solid #000000;
|
|
|
|
| 41 |
}
|
| 42 |
.stButton>button:hover {
|
| 43 |
+
background-color: #f0f0f0;
|
|
|
|
|
|
|
| 44 |
}
|
| 45 |
.stNumberInput label {
|
|
|
|
| 46 |
font-family: 'Roboto', sans-serif;
|
| 47 |
font-weight: 700;
|
| 48 |
font-size: 16px;
|
| 49 |
}
|
| 50 |
.stNumberInput input {
|
| 51 |
background-color: #ffffff;
|
| 52 |
+
color: #000000;
|
| 53 |
+
border: 2px solid #000000;
|
| 54 |
border-radius: 8px;
|
| 55 |
padding: 10px;
|
| 56 |
font-family: 'Roboto', sans-serif;
|
| 57 |
font-size: 14px;
|
|
|
|
| 58 |
}
|
| 59 |
.stNumberInput input:focus {
|
| 60 |
outline: none;
|
| 61 |
+
border: 2px solid #000000;
|
|
|
|
| 62 |
}
|
| 63 |
</style>
|
| 64 |
""", unsafe_allow_html=True)
|
|
|
|
| 102 |
st.title("Power Consumption Predictor")
|
| 103 |
st.markdown("""
|
| 104 |
Enter values for one timestep to predict power consumption for Zone1, Zone2, and Zone3.
|
| 105 |
+
Results will be displayed as a bar plot and a table.
|
| 106 |
""")
|
| 107 |
|
| 108 |
# Input section
|
|
|
|
| 180 |
st.session_state.pred_df.reset_index().melt(id_vars='index', value_vars=labels, var_name='Zone', value_name='Power Consumption'),
|
| 181 |
x='index', y='Power Consumption', color='Zone', barmode='group',
|
| 182 |
title='Predicted Power Consumption by Zone',
|
| 183 |
+
labels={'index': 'Sample', 'Power Consumption': 'Power Consumption (Original Scale)'}
|
|
|
|
| 184 |
)
|
| 185 |
fig.update_layout(
|
| 186 |
plot_bgcolor='white',
|
| 187 |
paper_bgcolor='white',
|
| 188 |
+
font=dict(family='Roboto', size=12),
|
| 189 |
+
title_font=dict(size=18, family='Roboto'),
|
| 190 |
xaxis_title="Sample",
|
| 191 |
yaxis_title="Power Consumption (Original Scale)",
|
| 192 |
legend_title="Zones",
|