DishaMondal2024 commited on
Commit
33a085f
·
verified ·
1 Parent(s): 0948262

Upload 3 files

Browse files
Files changed (3) hide show
  1. inference.py +30 -0
  2. requirements.txt +3 -0
  3. time_slot_model.joblib +3 -0
inference.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import joblib
2
+ import pandas as pd
3
+ from sklearn.preprocessing import LabelEncoder
4
+
5
+ # Load the trained model
6
+ model = joblib.load('time_slot_model.joblib')
7
+
8
+ # Load the LabelEncoder used in training (if applicable)
9
+ # label_encoder = joblib.load('label_encoder.joblib') # Uncomment if you used a LabelEncoder
10
+
11
+ def preprocess_input(user_pref):
12
+ # Example preprocessing; adjust based on your actual preprocessing steps
13
+ user_input = pd.get_dummies(pd.Series([user_pref]), prefix='Pref')
14
+ return user_input
15
+
16
+ def predict(user_pref):
17
+ # Preprocess the input
18
+ user_input = preprocess_input(user_pref)
19
+
20
+ # Ensure the input has the same columns as the training data
21
+ user_input = user_input.reindex(columns=model.feature_importances_, fill_value=0)
22
+
23
+ # Make a prediction
24
+ prediction = model.predict(user_input)
25
+ return prediction[0]
26
+
27
+ # Example usage:
28
+ # user_pref = 'noon' # Replace with actual user preference
29
+ # prediction = predict(user_pref)
30
+ # print(f"Predicted next rescheduled time: {prediction}")
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ pandas
2
+ scikit-learn
3
+ joblib
time_slot_model.joblib ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a54db130c87e319dd2680f789c20d6058064cc3004c061483d4b13b1f4ed61ab
3
+ size 102729