-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
47 lines (33 loc) · 1.09 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import streamlit as st
import numpy as np
import pandas as pd
# Load the dataset
fruits = pd.read_table('fruit_data_with_colors.txt')
# Streamlit app title
st.title("Fruit Classification 🍓🍉🍒🍑")
st.write("Classifying different types of fruits based on various attributes.")
# Create two columns with different widths
col1, col2 = st.columns([2, 1]) # 2:1 ratio for column widths
# Part 1: Display dataset and its shape
with col1:
st.subheader("Dataset Preview")
st.write(fruits.head())
st.write("Shape of the dataset:", fruits.shape)
# Part 2: Display unique fruit names
with col2:
st.subheader("Fruit Names")
st.write(fruits['fruit_name'].unique())
col3, col4 = st.columns(2)
with col3:
# Display counts of each fruit
st.subheader("Fruit Counts")
fruit_counts = fruits.groupby('fruit_name').size()
st.bar_chart(fruit_counts)
# Display the KNN plot
st.subheader("KNN Decision Boundary")
st.image('knn.png')
with col4:
st.subheader("Box Plot")
st.image('fruits_boxfig.png')
st.subheader("Scatter-Matrix")
st.image('scatter.png')