Spaces:
Runtime error
Runtime error
Update projects/ML_DiabetesPrediction/ML_DiabetesPrediction.py
Browse files
projects/ML_DiabetesPrediction/ML_DiabetesPrediction.py
CHANGED
|
@@ -1,34 +1,15 @@
|
|
| 1 |
-
from
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|