| import streamlit as st
|
| import pandas as pd
|
| import joblib
|
|
|
|
|
| pipeline = joblib.load('xgb_pipeline.joblib')
|
| le = joblib.load('label_encoder.joblib')
|
|
|
| st.title('Cheese Milk Type Classifier')
|
|
|
|
|
| country = st.selectbox('Country', [
|
| 'France', 'Italy', 'Switzerland', 'United States', 'Germany',
|
| 'Spain', 'England', 'Australia', 'Canada', 'Greece'
|
| ])
|
|
|
| texture = st.selectbox('Texture', [
|
| 'creamy', 'firm', 'crumbly', 'smooth', 'hard', 'soft', 'dense',
|
| 'elastic', 'dry', 'buttery', 'mild', 'open'
|
| ])
|
|
|
| rind = st.selectbox('Rind', [
|
| 'natural', 'washed', 'none', 'ash coated', 'leaf wrapped', 'Unknown'
|
| ])
|
|
|
| vegetarian = st.selectbox('Vegetarian Status', ['True', 'False'])
|
|
|
| flavor = st.selectbox('Flavor', [
|
| 'nutty', 'mild', 'sweet', 'earthy', 'fruity', 'acidic', 'buttery',
|
| 'smokey', 'full-flavored', 'salty', 'creamy', 'sharp', 'bitter', 'Unknown'
|
| ])
|
|
|
| input_df = pd.DataFrame({
|
| 'country': [country],
|
| 'texture': [texture],
|
| 'rind': [rind],
|
| 'vegetarian': [vegetarian],
|
| 'flavor': [flavor]
|
| })
|
|
|
|
|
| if st.button('Predict', key='predict_button'):
|
| pred_int = pipeline.predict(input_df)[0]
|
| pred_label = le.inverse_transform([pred_int])[0]
|
| st.write(f'Predicted Milk Type: {pred_label}')
|
|
|