import joblib import pandas as pd import streamlit as st model = joblib.load('model.joblib') def main(): st.title("Wine Quality Analysis") with st.form("questionaire"): fixed_acidity = st.slider("Fixed Acidity", min_value=0.0, max_value=20.0, step=0.01) volatile_acidity = st.slider("Volatile Acidity", min_value=0.0, max_value=20.0, step=0.01) citric_acid = st.slider("Citric Acid", min_value=0.0, max_value=1.0, step=0.01) residual_sugar = st.slider("Residual Sugar", min_value=0.0, max_value=20.0, step=0.01) chlorides = st.slider("Chlorides", min_value=0.0, max_value=1.0, step=0.01) free_sulfur_dioxide = st.slider("Free Sulfur Dioxide", min_value=0.0, max_value=100.0, step=0.01) total_sulfur_dioxide = st.slider("Total Sulfur Dioxide", min_value=0.0, max_value=500.0, step=0.01) density = st.slider("Density", min_value=0.0, max_value=10.0, step=0.01) ph = st.slider("pH", min_value=1.0, max_value=14.0, step=0.01) sulphates = st.slider("Sulphates", min_value=0.0, max_value=20.0, step=0.01) alcohol = st.slider("Alcohol", min_value=0.0, max_value=25.0, step=0.01) clicked = st.form_submit_button("Predict quality") if clicked: result = model.predict(pd.DataFrame({ "fixed acidity": [fixed_acidity], "volatile acidity": [volatile_acidity], "citric acid": [citric_acid], "residual sugar": [residual_sugar], "chlorides": [chlorides], "free sulfur dioxide": [free_sulfur_dioxide], "total sulfur dioxide": [total_sulfur_dioxide], "density": [density], "pH": [ph], "sulphates": [sulphates], "alcohol": [alcohol] })) predicted_quality_rank = result[0] st.success('The predicted wine quality ranking is {}'.format(predicted_quality_rank)) if __name__=='__main__': main()