eziokittu commited on
Commit
b16356d
·
verified ·
1 Parent(s): b4a5250

Update projects/ML_DiabetesPrediction/ML_DiabetesPrediction.py

Browse files
projects/ML_DiabetesPrediction/ML_DiabetesPrediction.py CHANGED
@@ -1,34 +1,15 @@
1
- from projects.ML_StudentPerformance.src.pipelines.predict_pipeline import CustomData, PredictPipeline
2
- from pydantic import BaseModel
3
-
4
- # Function to handle the prediction logic
5
- def predict_student_performance(data):
6
- # Convert the incoming form data to a DataFrame
7
- pred_df = data.get_data_as_dataframe()
8
-
9
- # Initialize the prediction pipeline
10
- predict_pipeline = PredictPipeline()
11
- results = predict_pipeline.predict(pred_df)
12
-
13
- return results[0] # Return the first prediction result
14
-
15
- # Function to handle form data conversion
16
- def create_custom_data(gender, ethnicity, parental_level_of_education, lunch, test_preparation_course, reading_score, writing_score):
17
- return CustomData(
18
- gender=gender,
19
- race_ethnicity=ethnicity,
20
- parental_level_of_education=parental_level_of_education,
21
- lunch=lunch,
22
- test_preparation_course=test_preparation_course,
23
- reading_score=float(reading_score),
24
- writing_score=float(writing_score)
25
- )
26
-
27
- class form1(BaseModel):
28
- gender: str
29
- ethnicity: str
30
- parental_level_of_education: str
31
- lunch: str
32
- test_preparation_course: str
33
- reading_score: float
34
- writing_score: float
 
1
+ from pydantic import BaseModel
2
+ import pickle
3
+
4
+ # loading the saved model
5
+ model_ML_DiabetesPrediction = pickle.load(open('./projects/ML_DiabetesPrediction/model_DiabetesPrediction.sav', 'rb'))
6
+
7
+ class form2(BaseModel):
8
+ Pregnancies: int
9
+ Glucose: int
10
+ BloodPressure: int
11
+ SkinThickness: int
12
+ Insulin: int
13
+ BMI: float
14
+ DiabetesPedigreeFunction: float
15
+ Age: int