Pasham123 commited on
Commit
51da677
·
verified ·
1 Parent(s): 49f325f

Update pages/Data.upload.py

Browse files
Files changed (1) hide show
  1. pages/Data.upload.py +44 -0
pages/Data.upload.py CHANGED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+
4
+ # Page Config
5
+ st.set_page_config(page_title="AutoML - Classification", layout="wide")
6
+
7
+ st.title("Classification Data")
8
+
9
+ # Upload button
10
+ uploaded_file = st.file_uploader("Upload Data", type=["csv", "json", "xml", "xlsx"])
11
+
12
+ if uploaded_file is not None:
13
+ file_extension = uploaded_file.name.split(".")[-1]
14
+
15
+ # Read dataset based on file type
16
+ if file_extension == "csv":
17
+ df = pd.read_csv(uploaded_file)
18
+ elif file_extension == "json":
19
+ df = pd.read_json(uploaded_file)
20
+ elif file_extension == "xml":
21
+ df = pd.read_xml(uploaded_file)
22
+ elif file_extension == "xlsx":
23
+ df = pd.read_excel(uploaded_file)
24
+
25
+ st.success("File uploaded successfully!")
26
+
27
+ # Dropdown to select basic info
28
+ options = ["Head of Data", "Data Info", "Describe Data"]
29
+ selected_option = st.selectbox("Select Basic Info to View", options)
30
+
31
+ if selected_option == "Head of Data":
32
+ st.write(df.head())
33
+ elif selected_option == "Data Info":
34
+ buffer = []
35
+ df.info(buf=buffer)
36
+ s = "\n".join(str(x) for x in buffer)
37
+ st.text(s)
38
+ elif selected_option == "Describe Data":
39
+ st.write(df.describe())
40
+
41
+ # Submit button to redirect to EDA page
42
+ if st.button("Submit"):
43
+ st.session_state["uploaded_df"] = df # Store data in session state
44
+ st.switch_page("pages/1_EDA.py") # Redirect to EDA page