|
|
import streamlit as st |
|
|
import numpy as np |
|
|
import joblib |
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
model = joblib.load("rice_model.pkl") |
|
|
|
|
|
|
|
|
st.title("Rice Classification Model") |
|
|
st.write("Enter the grain properties to predict the type of rice.") |
|
|
|
|
|
|
|
|
area = st.number_input("Area", min_value=1000, max_value=10000, value=5000) |
|
|
major_axis_length = st.number_input("Major Axis Length", min_value=50.0, max_value=200.0, value=100.0) |
|
|
minor_axis_length = st.number_input("Minor Axis Length", min_value=30.0, max_value=100.0, value=50.0) |
|
|
eccentricity = st.number_input("Eccentricity", min_value=0.5, max_value=1.0, value=0.75) |
|
|
convex_area = st.number_input("Convex Area", min_value=1000, max_value=10000, value=5000) |
|
|
equiv_diameter = st.number_input("Equivalent Diameter", min_value=30.0, max_value=120.0, value=75.0) |
|
|
extent = st.number_input("Extent", min_value=0.4, max_value=1.0, value=0.7) |
|
|
perimeter = st.number_input("Perimeter", min_value=100.0, max_value=500.0, value=250.0) |
|
|
roundness = st.number_input("Roundness", min_value=0.5, max_value=1.0, value=0.75) |
|
|
aspect_ratio = st.number_input("Aspect Ratio", min_value=1.0, max_value=3.0, value=1.5) |
|
|
|
|
|
|
|
|
if st.button("Predict Rice Type"): |
|
|
input_features = np.array([[area, major_axis_length, minor_axis_length, eccentricity, convex_area, |
|
|
equiv_diameter, extent, perimeter, roundness, aspect_ratio]]) |
|
|
prediction = model.predict(input_features)[0] |
|
|
rice_type = "Type 1" if prediction == 1 else "Type 0" |
|
|
st.success(f"Predicted Rice Type: {rice_type}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|