Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import streamlit as st
|
|
| 4 |
import pandas as pd
|
| 5 |
import numpy as np
|
| 6 |
from prediction import predict
|
|
|
|
| 7 |
from sklearn.datasets import load_iris
|
| 8 |
from ydata_profiling.utils.cache import cache_file
|
| 9 |
|
|
@@ -16,9 +17,9 @@ setosa, versicolor, virginica')
|
|
| 16 |
st.image('https://machinelearninghd.com/wp-content/uploads/2021/03/iris-dataset.png')
|
| 17 |
st.image('https://www.integratedots.com/wp-content/uploads/2019/06/iris_petal-sepal-e1560211020463.png')
|
| 18 |
|
| 19 |
-
|
| 20 |
-
#iris = load_iris(as_frame=True)
|
| 21 |
|
|
|
|
| 22 |
@st.cache_data
|
| 23 |
def load_data(url):
|
| 24 |
df = pd.read_csv(url)
|
|
@@ -31,14 +32,17 @@ iris = cache_file(
|
|
| 31 |
|
| 32 |
df = load_data(iris)
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
-
|
| 41 |
-
#df['Target'] = df['Target'].apply(lambda x: iris['target_names'][x])
|
| 42 |
|
| 43 |
st.header('Plant Features')
|
| 44 |
col1, col2 = st.columns(2)
|
|
@@ -54,12 +58,4 @@ with col2:
|
|
| 54 |
|
| 55 |
if st.button('Predict type of Iris'):
|
| 56 |
result = predict(np.array([[sepal_l, sepal_w, petal_l, petal_w]]))
|
| 57 |
-
st.text(result[0])
|
| 58 |
-
|
| 59 |
-
st.write("---")
|
| 60 |
-
if st.checkbox("Sample preview the Iris Dataset"):
|
| 61 |
-
#st.write(df.sample(10)) # Same as st.write(df)
|
| 62 |
-
pr = ProfileReport(df,title="Dataset Report")
|
| 63 |
-
st_profile_report(pr)
|
| 64 |
-
|
| 65 |
-
st.write("---")
|
|
|
|
| 4 |
import pandas as pd
|
| 5 |
import numpy as np
|
| 6 |
from prediction import predict
|
| 7 |
+
from function import filter_dataframe
|
| 8 |
from sklearn.datasets import load_iris
|
| 9 |
from ydata_profiling.utils.cache import cache_file
|
| 10 |
|
|
|
|
| 17 |
st.image('https://machinelearninghd.com/wp-content/uploads/2021/03/iris-dataset.png')
|
| 18 |
st.image('https://www.integratedots.com/wp-content/uploads/2019/06/iris_petal-sepal-e1560211020463.png')
|
| 19 |
|
| 20 |
+
st.write("---")
|
|
|
|
| 21 |
|
| 22 |
+
# Load Dataset
|
| 23 |
@st.cache_data
|
| 24 |
def load_data(url):
|
| 25 |
df = pd.read_csv(url)
|
|
|
|
| 32 |
|
| 33 |
df = load_data(iris)
|
| 34 |
|
| 35 |
+
if st.checkbox('Open Iris Dataset'):
|
| 36 |
+
fd = filter_dataframe(df)
|
| 37 |
+
st.dataframe(fd, use_container_width=True)
|
| 38 |
+
|
| 39 |
+
st.write("---")
|
| 40 |
|
| 41 |
+
if st.checkbox('Open EDA Report'):
|
| 42 |
+
pr = ProfileReport(df)
|
| 43 |
+
st_profile_report(pr)
|
| 44 |
|
| 45 |
+
st.write("---")
|
|
|
|
| 46 |
|
| 47 |
st.header('Plant Features')
|
| 48 |
col1, col2 = st.columns(2)
|
|
|
|
| 58 |
|
| 59 |
if st.button('Predict type of Iris'):
|
| 60 |
result = predict(np.array([[sepal_l, sepal_w, petal_l, petal_w]]))
|
| 61 |
+
st.text(result[0])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|