Copopopopo commited on
Commit
7239ebc
·
verified ·
1 Parent(s): 8b13e8e

second commit

Browse files
Files changed (3) hide show
  1. app.py +25 -0
  2. random_forest_model.joblib +3 -0
  3. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +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=1000)
18
+ opex = st.slider("OPEX (RM mil)", min_value=0, max_value=1000)
19
+ performance = st.slider("Performance", min_value=0, max_value=5)
20
+ revenue = st.slider("Revenue (RM mil)", min_value=0, max_value=1000)
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}")
random_forest_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43902bbf9e7016896e0327d1018ff15a0894e961cc0dcb6536b51244395792e5
3
+ size 95801
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==4.39.0
2
+ joblib==1.4.0
3
+ scikit_learn==1.3.0