File size: 834 Bytes
d6dd938
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7239ebc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import joblib
import streamlit as st

# Load the model
model = joblib.load(r'random_forest_model.joblib')

# Define the prediction function
def prediction(first, second, third, forth):
    prediction = model.predict([[first, second, third, forth]])
    label = ['Not Affordable', 'Affordable']
    return label[prediction[0]]

# Streamlit interface
st.title("Affordability Prediction")

# Create sliders for input
capex = st.slider("CAPEX (RM mil)", min_value=0, max_value=100)
opex = st.slider("OPEX (RM mil)", min_value=0, max_value=100)
performance = st.slider("Performance", min_value=0, max_value=5)
revenue = st.slider("Revenue (RM mil)", min_value=0, max_value=100)

# Button to make the prediction
if st.button("Predict"):
    result = prediction(capex, opex, performance, revenue)
    st.write(f"The prediction is: {result}")