esteele commited on
Commit
d68294a
·
verified ·
1 Parent(s): 30766a8

Create inference.py

Browse files
Files changed (1) hide show
  1. inference.py +24 -0
inference.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+
4
+ model = joblib.load("best_random_forest_model.joblib")
5
+ scaler = joblib.load("std_scaler.bin")
6
+
7
+ def predict(data):
8
+
9
+ df = pd.DataFrame(
10
+ data,
11
+ columns=[
12
+ "LoanOriginalAmount",
13
+ "CreditScoreRangeLower",
14
+ "StatedMonthlyIncome",
15
+ "Investors",
16
+ "MonthlyLoanPayment",
17
+ ],
18
+ )
19
+
20
+ scaled = scaler.transform(df.values)
21
+
22
+ prediction = model.predict(scaled)
23
+
24
+ return prediction.tolist()