Update pages/4_Model_Creation_and_Evaluation.py
Browse files
pages/4_Model_Creation_and_Evaluation.py
CHANGED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
# Page configuration
|
| 6 |
+
st.set_page_config(page_title="Predictive Modelling", layout="wide")
|
| 7 |
+
|
| 8 |
+
# Title with centered alignment
|
| 9 |
+
st.markdown(
|
| 10 |
+
"""
|
| 11 |
+
<h1 style="text-align: center; color: white;">📱 Predictive Model Creation and Evaluation 💻</h1>
|
| 12 |
+
""",
|
| 13 |
+
unsafe_allow_html=True
|
| 14 |
+
)
|
| 15 |
+
# Flowchart title
|
| 16 |
+
st.markdown(
|
| 17 |
+
'<div class="title">Model Creation Flow</div>',
|
| 18 |
+
unsafe_allow_html=True
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Flowchart GIF with 90% width
|
| 22 |
+
st.markdown(
|
| 23 |
+
"""
|
| 24 |
+
<div style="text-align: center;">
|
| 25 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/67441c51a784a9d15cb12871/70th8t5_UUCWKu25u6F9s.gif" alt="model-creation-flowchart.gif" width="90%" />
|
| 26 |
+
</div>
|
| 27 |
+
""",
|
| 28 |
+
unsafe_allow_html=True
|
| 29 |
+
)
|
| 30 |
+
df = st.session_state.get("dataset")
|
| 31 |
+
|
| 32 |
+
# Exclude 'ProductID' from the dataset
|
| 33 |
+
if df is not None:
|
| 34 |
+
df = df.drop(columns=['ProductID'], errors='ignore') # Exclude 'ProductID' if it exists
|
| 35 |
+
|
| 36 |
+
st.subheader("Dataset Preview:")
|
| 37 |
+
st.write(df.head())
|
| 38 |
+
|
| 39 |
+
st.subheader("Info of the Dataset:")
|
| 40 |
+
# Redirect the output of df.info() to a string buffer
|
| 41 |
+
buffer = StringIO()
|
| 42 |
+
df.info(buf=buffer)
|
| 43 |
+
|
| 44 |
+
# Display the content in Streamlit
|
| 45 |
+
st.write(buffer.getvalue())
|
| 46 |
+
|
| 47 |
+
st.subheader("Dataset Description:")
|
| 48 |
+
st.write(df.describe())
|
| 49 |
+
|
| 50 |
+
st.subheader("Shape of the Dataset:")
|
| 51 |
+
st.write(df.shape)
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
# Custom title styling
|
| 55 |
+
st.markdown(
|
| 56 |
+
"""
|
| 57 |
+
<style>
|
| 58 |
+
.title {
|
| 59 |
+
color: white; /* White color for better visibility */
|
| 60 |
+
font-size: 36px; /* Large font size */
|
| 61 |
+
font-weight: bold; /* Bold text */
|
| 62 |
+
text-align: center; /* Center alignment */
|
| 63 |
+
margin-top: 20px;
|
| 64 |
+
}
|
| 65 |
+
</style>
|
| 66 |
+
""",
|
| 67 |
+
unsafe_allow_html=True
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
# Custom background with overlay
|
| 73 |
+
st.markdown(
|
| 74 |
+
"""
|
| 75 |
+
<style>
|
| 76 |
+
.stApp {
|
| 77 |
+
background-image: url("https://cdn-uploads.huggingface.co/production/uploads/67441c51a784a9d15cb12871/FVcAdQ1wc7rCkfdnFsZft.jpeg");
|
| 78 |
+
background-size: cover;
|
| 79 |
+
background-position: center;
|
| 80 |
+
height: 100vh;
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/* Semi-transparent overlay */
|
| 84 |
+
.stApp::before {
|
| 85 |
+
content: "";
|
| 86 |
+
position: absolute;
|
| 87 |
+
top: 0;
|
| 88 |
+
left: 0;
|
| 89 |
+
width: 100%;
|
| 90 |
+
height: 100%;
|
| 91 |
+
background: rgba(0, 0, 0, 0.4); /* 40% transparency */
|
| 92 |
+
z-index: -1;
|
| 93 |
+
}
|
| 94 |
+
</style>
|
| 95 |
+
""",
|
| 96 |
+
unsafe_allow_html=True
|
| 97 |
+
)
|