|
|
| import streamlit as st |
| import pandas as pd |
| import pickle |
|
|
| |
| model = pickle.load(open('model (10).pkl', 'rb')) |
|
|
| |
| class_mapping = { |
| 0: 'Sanora', |
| 1: 'Mamra', |
| 2: 'Regular', |
| |
| } |
|
|
| st.title('Almond Classification') |
| st.write('This web app classifies almonds based on your input features.') |
|
|
| |
| length_major_axis = st.number_input('Length (major axis)', min_value=269.356903, max_value=279.879883) |
| width_minor_axis = st.number_input('Width (minor axis)', min_value=176.023636, max_value=227.940628) |
| thickness_depth = st.number_input('Thickness (depth)', min_value=107.253448, max_value=127.795132) |
| area = st.number_input('Area', min_value=18471.5, max_value=36683.0) |
| perimeter = st.number_input('Perimeter', min_value=551.688379, max_value=887.310743) |
| roundness = st.slider('Roundness', min_value=0.472718, max_value=0.643761, step=0.01) |
| solidity = st.slider('Solidity', min_value=0.931800, max_value=0.973384, step=0.01) |
| compactness = st.slider('Compactness', min_value=1.383965, max_value=1.764701, step=0.01) |
| aspect_ratio = st.slider('Aspect Ratio', min_value=1.530231, max_value=1.705716, step=0.01) |
| eccentricity = st.slider('Eccentricity', min_value=0.75693, max_value=0.81012, step=0.01) |
| extent = st.slider('Extent', min_value=0.656535, max_value=0.725739, step=0.01) |
| convex_area = st.number_input('Convex hull (convex area)', min_value=18068.0, max_value=36683.0, step=0.01) |
|
|
| |
| if st.button('Predict'): |
| |
| scaler = pickle.load(open('scaler.pkl', 'rb')) |
| |
| |
| input_features = [[length_major_axis, width_minor_axis, thickness_depth, area, |
| perimeter, roundness, solidity, compactness, aspect_ratio, |
| eccentricity, extent, convex_area]] |
| |
| |
| input_features_scaled = scaler.transform(input_features) |
| |
| |
| prediction = model.predict(input_features_scaled) |
|
|
|
|
|
|
| |
| predicted_class_name = class_mapping[prediction[0]] |
| |
| st.write(f'The predicted class is: {predicted_class_name}') |
|
|
|
|