Spaces:
Runtime error
Runtime error
Download app.py from ceckenrode/AutoMLUsingStreamlit-Plotly: direct link, hf CLI and curl.
- Browser
- Download file 991 Bytes
-
https://huggingface.co/spaces/ceckenrode/AutoMLUsingStreamlit-Plotly/resolve/main/app.py
- Command line
-
hf download hf://spaces/ceckenrode/AutoMLUsingStreamlit-Plotly/app.py
-
curl -L -o app.py https://huggingface.co/spaces/ceckenrode/AutoMLUsingStreamlit-Plotly/resolve/main/app.py
991 Bytes
| import streamlit as st | |
| import pandas as pd | |
| import plotly.express as px | |
| st.set_page_config(page_title="AutoML Streamlit App", page_icon=":robot:", layout="wide") | |
| st.title("AutoML Streamlit App") | |
| # Upload a CSV dataset | |
| uploaded_file = st.file_uploader("Upload your dataset", type=["csv"]) | |
| if uploaded_file is not None: | |
| # Load the dataset and display the first 5 rows | |
| df = pd.read_csv(uploaded_file) | |
| st.dataframe(df.head()) | |
| # Generate a treemap or sunburst plot based on data types | |
| numerical_cols = df.select_dtypes(include=["float", "int"]).columns | |
| categorical_cols = df.select_dtypes(include=["object"]).columns | |
| if len(numerical_cols) >= 2: | |
| fig = px.scatter_matrix(df, dimensions=numerical_cols) | |
| st.plotly_chart(fig) | |
| elif len(categorical_cols) >= 2: | |
| fig = px.treemap(df, path=categorical_cols) | |
| st.plotly_chart(fig) | |
| else: | |
| fig = px.sunburst(df, path=categorical_cols + numerical_cols) | |
| st.plotly_chart(fig) |