Spaces:
Runtime error
Runtime error
Update pages/1_Upload_the_data.py
Browse files- pages/1_Upload_the_data.py +11 -37
pages/1_Upload_the_data.py
CHANGED
|
@@ -2,45 +2,15 @@ import streamlit as st
|
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
st.markdown("""
|
| 5 |
-
<style>
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
padding: 20px;
|
| 9 |
-
font-family: Arial, sans-serif;
|
| 10 |
-
}
|
| 11 |
-
.upload-title {
|
| 12 |
-
color: #c71585;
|
| 13 |
-
font-size: 28px;
|
| 14 |
-
font-weight: bold;
|
| 15 |
-
}
|
| 16 |
-
.upload-description {
|
| 17 |
-
font-size: 18px;
|
| 18 |
-
color: #4F4F4F;
|
| 19 |
-
margin-bottom: 20px;
|
| 20 |
-
}
|
| 21 |
-
.success-message {
|
| 22 |
-
color: green;
|
| 23 |
-
font-size: 18px;
|
| 24 |
-
font-weight: bold;
|
| 25 |
-
}
|
| 26 |
-
.error-message {
|
| 27 |
-
color: red;
|
| 28 |
-
font-size: 18px;
|
| 29 |
-
font-weight: bold;
|
| 30 |
-
}
|
| 31 |
-
</style>
|
| 32 |
-
""", unsafe_allow_html=True)
|
| 33 |
-
|
| 34 |
-
st.markdown("""
|
| 35 |
-
<div class="upload-container">
|
| 36 |
-
<h2 class="upload-title">📂 Upload Your Classification Dataset</h2>
|
| 37 |
-
<p class="upload-description">
|
| 38 |
Upload your dataset in CSV, Excel, JSON, XML, or HTML format. Drag and drop your file or click to browse.
|
| 39 |
</p>
|
| 40 |
</div>
|
| 41 |
""", unsafe_allow_html=True)
|
| 42 |
|
| 43 |
-
|
| 44 |
uploaded_file = st.file_uploader(
|
| 45 |
"Drop your dataset here or click to upload",
|
| 46 |
type=["csv", "xlsx", "json", "xml", "html"]
|
|
@@ -61,11 +31,14 @@ if uploaded_file:
|
|
| 61 |
elif file_extension == "html":
|
| 62 |
df = pd.read_html(uploaded_file)[0]
|
| 63 |
else:
|
| 64 |
-
st.
|
| 65 |
st.stop()
|
| 66 |
|
| 67 |
-
st.
|
|
|
|
|
|
|
| 68 |
|
|
|
|
| 69 |
st.dataframe(df.head())
|
| 70 |
|
| 71 |
st.markdown("#### You're All Set! What’s Next?📌")
|
|
@@ -74,5 +47,6 @@ if uploaded_file:
|
|
| 74 |
if st.button("➡️Proceed to Simple EDA"):
|
| 75 |
st.switch_page("pages/2_Simple_EDA.py")
|
| 76 |
|
|
|
|
| 77 |
except Exception as e:
|
| 78 |
-
st.
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
|
| 4 |
st.markdown("""
|
| 5 |
+
<div style="text-align: center; margin-bottom: 20px;">
|
| 6 |
+
<h2 style="color: #c71585; font-size: 28px;">Upload Your Classification Dataset📂</h2>
|
| 7 |
+
<p style="font-size: 18px; color: #4F4F4F;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
Upload your dataset in CSV, Excel, JSON, XML, or HTML format. Drag and drop your file or click to browse.
|
| 9 |
</p>
|
| 10 |
</div>
|
| 11 |
""", unsafe_allow_html=True)
|
| 12 |
|
| 13 |
+
# Upload the file
|
| 14 |
uploaded_file = st.file_uploader(
|
| 15 |
"Drop your dataset here or click to upload",
|
| 16 |
type=["csv", "xlsx", "json", "xml", "html"]
|
|
|
|
| 31 |
elif file_extension == "html":
|
| 32 |
df = pd.read_html(uploaded_file)[0]
|
| 33 |
else:
|
| 34 |
+
st.error("❌ Unsupported file format!")
|
| 35 |
st.stop()
|
| 36 |
|
| 37 |
+
st.session_state.df = df
|
| 38 |
+
|
| 39 |
+
st.success(f"{uploaded_file.name} uploaded successfully!✅")
|
| 40 |
|
| 41 |
+
# if the data upload Successfully Display the Data
|
| 42 |
st.dataframe(df.head())
|
| 43 |
|
| 44 |
st.markdown("#### You're All Set! What’s Next?📌")
|
|
|
|
| 47 |
if st.button("➡️Proceed to Simple EDA"):
|
| 48 |
st.switch_page("pages/2_Simple_EDA.py")
|
| 49 |
|
| 50 |
+
|
| 51 |
except Exception as e:
|
| 52 |
+
st.error(f"⚠️ Error loading the file: {e}")
|