awacke1 commited on
Commit
3bc214a
·
1 Parent(s): 902fa9d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import plotly.express as px
4
+
5
+ st.set_page_config(page_title="AutoML Streamlit App", page_icon=":robot:", layout="wide")
6
+
7
+ st.title("AutoML Streamlit App")
8
+
9
+ # Upload a CSV dataset
10
+ uploaded_file = st.file_uploader("Upload your dataset", type=["csv"])
11
+ if uploaded_file is not None:
12
+ # Load the dataset and display the first 5 rows
13
+ df = pd.read_csv(uploaded_file)
14
+ st.dataframe(df.head())
15
+
16
+ # Generate a treemap or sunburst plot based on data types
17
+ numerical_cols = df.select_dtypes(include=["float", "int"]).columns
18
+ categorical_cols = df.select_dtypes(include=["object"]).columns
19
+
20
+ if len(numerical_cols) >= 2:
21
+ fig = px.scatter_matrix(df, dimensions=numerical_cols)
22
+ st.plotly_chart(fig)
23
+ elif len(categorical_cols) >= 2:
24
+ fig = px.treemap(df, path=categorical_cols)
25
+ st.plotly_chart(fig)
26
+ else:
27
+ fig = px.sunburst(df, path=categorical_cols + numerical_cols)
28
+ st.plotly_chart(fig)