QualityRedWine / app.py
JBDef's picture
Update app.py
f6b9cc2
raw
history blame
1.65 kB
import joblib
import pandas as pd
import streamlit as st
model = joblib.load('model.joblib')
def main():
st.title("Predict Quality of Red Wine")
with st.form("questionaire"):
fixed_acidity = st.slider("Fixed acidity",min_value=0.00,max_value=50.00)
volatile_acidity = st.slider("Volatile acidity",min_value=0.00,max_value=5.00)
citric_acid = st.slider("Citric acid",min_value=0.00,max_value=1.00)
chlorides= st.slider("Chlorides",min_value=0.00,max_value=100.00)
total_sulfur_dioxide = st.slider("Total sulfur dioxide",min_value=0.00,max_value=500.00)
density = st.slider("Density",min_value=0.00,max_value=5.00)
sulphates = st.slider("Sulphates",min_value=0.00,max_value=5.00)
alcohol = st.slider("Alcohol",min_value=0.00,max_value=50.00)
clicked = st.form_submit_button("Predict Quality of Red Wine")
if clicked:
result=model.predict(pd.DataFrame({"fixed_acidity": [fixed_acidity],
"volatile_acidity": [volatile_acidity],
"citric_acid": [citric_acid],
"chlorides": [chlorides],
"total_sulfur_dioxide": [total_sulfur_dioxide],
"density": [density],
"sulphates": [sulphates],
"alcohol": [alcohol] }))
st.success("Your predicted quality is "+str(result[0]))
# Run main()
if __name__ == "__main__":
main()