Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,25 +1,25 @@
|
|
| 1 |
-
import joblib
|
| 2 |
-
import streamlit as st
|
| 3 |
-
|
| 4 |
-
# Load the model
|
| 5 |
-
model = joblib.load(r'random_forest_model.joblib')
|
| 6 |
-
|
| 7 |
-
# Define the prediction function
|
| 8 |
-
def prediction(first, second, third, forth):
|
| 9 |
-
prediction = model.predict([[first, second, third, forth]])
|
| 10 |
-
label = ['Not Affordable', 'Affordable']
|
| 11 |
-
return label[prediction[0]]
|
| 12 |
-
|
| 13 |
-
# Streamlit interface
|
| 14 |
-
st.title("Affordability Prediction")
|
| 15 |
-
|
| 16 |
-
# Create sliders for input
|
| 17 |
-
capex = st.slider("CAPEX (RM mil)", min_value=0, max_value=
|
| 18 |
-
opex = st.slider("OPEX (RM mil)", min_value=0, max_value=
|
| 19 |
-
performance = st.slider("Performance", min_value=0, max_value=5)
|
| 20 |
-
revenue = st.slider("Revenue (RM mil)", min_value=0, max_value=
|
| 21 |
-
|
| 22 |
-
# Button to make the prediction
|
| 23 |
-
if st.button("Predict"):
|
| 24 |
-
result = prediction(capex, opex, performance, revenue)
|
| 25 |
st.write(f"The prediction is: {result}")
|
|
|
|
| 1 |
+
import joblib
|
| 2 |
+
import streamlit as st
|
| 3 |
+
|
| 4 |
+
# Load the model
|
| 5 |
+
model = joblib.load(r'random_forest_model.joblib')
|
| 6 |
+
|
| 7 |
+
# Define the prediction function
|
| 8 |
+
def prediction(first, second, third, forth):
|
| 9 |
+
prediction = model.predict([[first, second, third, forth]])
|
| 10 |
+
label = ['Not Affordable', 'Affordable']
|
| 11 |
+
return label[prediction[0]]
|
| 12 |
+
|
| 13 |
+
# Streamlit interface
|
| 14 |
+
st.title("Affordability Prediction")
|
| 15 |
+
|
| 16 |
+
# Create sliders for input
|
| 17 |
+
capex = st.slider("CAPEX (RM mil)", min_value=0, max_value=100)
|
| 18 |
+
opex = st.slider("OPEX (RM mil)", min_value=0, max_value=100)
|
| 19 |
+
performance = st.slider("Performance", min_value=0, max_value=5)
|
| 20 |
+
revenue = st.slider("Revenue (RM mil)", min_value=0, max_value=100)
|
| 21 |
+
|
| 22 |
+
# Button to make the prediction
|
| 23 |
+
if st.button("Predict"):
|
| 24 |
+
result = prediction(capex, opex, performance, revenue)
|
| 25 |
st.write(f"The prediction is: {result}")
|