Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import numpy as np
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
# Define Model File Path
|
| 7 |
-
|
| 8 |
|
| 9 |
# Streamlit UI Setup
|
| 10 |
st.set_page_config(page_title="Wine Quality Prediction π·π¬", layout="centered")
|
|
@@ -28,14 +28,15 @@ st.markdown(
|
|
| 28 |
st.markdown('<h1 class="title">Wine Quality Prediction π·π¬</h1>', unsafe_allow_html=True)
|
| 29 |
st.write("Predicting Wine Quality based on wine parameters.")
|
| 30 |
|
| 31 |
-
#
|
| 32 |
-
if os.path.exists(
|
| 33 |
-
with open(
|
| 34 |
model = pickle.load(f)
|
|
|
|
| 35 |
model_loaded = True
|
| 36 |
else:
|
|
|
|
| 37 |
model_loaded = False
|
| 38 |
-
st.error(f"β Model file '{MODEL_PATH}' not found! Please upload the trained model.")
|
| 39 |
|
| 40 |
# User Inputs
|
| 41 |
fixed_acidity = st.number_input("Fixed Acidity", min_value=4.6, max_value=15.9, value=7.6)
|
|
|
|
| 4 |
import os
|
| 5 |
|
| 6 |
# Define Model File Path
|
| 7 |
+
model_path = "random_forest_pipeline.pkl"
|
| 8 |
|
| 9 |
# Streamlit UI Setup
|
| 10 |
st.set_page_config(page_title="Wine Quality Prediction π·π¬", layout="centered")
|
|
|
|
| 28 |
st.markdown('<h1 class="title">Wine Quality Prediction π·π¬</h1>', unsafe_allow_html=True)
|
| 29 |
st.write("Predicting Wine Quality based on wine parameters.")
|
| 30 |
|
| 31 |
+
# Check if model exists
|
| 32 |
+
if os.path.exists(model_path):
|
| 33 |
+
with open(model_path, "rb") as f:
|
| 34 |
model = pickle.load(f)
|
| 35 |
+
st.success("β
Model loaded successfully!")
|
| 36 |
model_loaded = True
|
| 37 |
else:
|
| 38 |
+
st.error(f"β Model file '{model_path}' not found! Please upload or train the model first.")
|
| 39 |
model_loaded = False
|
|
|
|
| 40 |
|
| 41 |
# User Inputs
|
| 42 |
fixed_acidity = st.number_input("Fixed Acidity", min_value=4.6, max_value=15.9, value=7.6)
|