Delete App.py
Browse files
App.py
DELETED
|
@@ -1,57 +0,0 @@
|
|
| 1 |
-
# -*- coding: utf-8 -*-
|
| 2 |
-
"""
|
| 3 |
-
Created on Mon Feb 6 09:56:29 2023
|
| 4 |
-
|
| 5 |
-
@author: HP
|
| 6 |
-
"""
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
import numpy as np
|
| 10 |
-
import pickle
|
| 11 |
-
import streamlit as st
|
| 12 |
-
|
| 13 |
-
# loading the saved model
|
| 14 |
-
#loaded_model = pickle.load(open('medical_insurance_cost_predictor.sav', 'rb'))
|
| 15 |
-
loaded_model = pickle.load(open('medical_insurance_cost_predictor.h5', 'rb'))
|
| 16 |
-
|
| 17 |
-
#creating a function for Prediction
|
| 18 |
-
def medical_insurance_cost_prediction(input_data):
|
| 19 |
-
# changing the input_data to numpy array
|
| 20 |
-
input_data_as_numpy_array = np.asarray(input_data)
|
| 21 |
-
|
| 22 |
-
# reshape the array as we are predicting for one instance
|
| 23 |
-
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
|
| 24 |
-
|
| 25 |
-
prediction = loaded_model.predict(input_data_reshaped)
|
| 26 |
-
print(prediction)
|
| 27 |
-
|
| 28 |
-
return prediction
|
| 29 |
-
|
| 30 |
-
def main():
|
| 31 |
-
|
| 32 |
-
#giving a title
|
| 33 |
-
#st.title('Medical Insurance Prediction Web App')
|
| 34 |
-
st.title('It is working!!!')
|
| 35 |
-
|
| 36 |
-
#getting input from the user
|
| 37 |
-
|
| 38 |
-
age = st.text_input('Age')
|
| 39 |
-
sex = st.text_input('Sex: 0 -> Female, 1 -> Male')
|
| 40 |
-
bmi = st.text_input('Body Mass Index')
|
| 41 |
-
children = st.text_input('Number of Children')
|
| 42 |
-
smoker = st.text_input('Smoker: 0 -> No, 1 -> Yes')
|
| 43 |
-
region = st.text_input('Region of Living: 0 -> NorthEast, 1-> NorthWest, 2-> SouthEast, 3-> SouthWest')
|
| 44 |
-
|
| 45 |
-
#code for prediction
|
| 46 |
-
diagnosis = ''
|
| 47 |
-
|
| 48 |
-
# getting the input data from the user
|
| 49 |
-
#if st.button('Predicted Medical Insurance Cost: '):
|
| 50 |
-
if st.button('Hit this button!: '):
|
| 51 |
-
diagnosis = medical_insurance_cost_prediction([age,sex,bmi,children,smoker,region])
|
| 52 |
-
|
| 53 |
-
st.success(diagnosis)
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
if __name__ == '__main__':
|
| 57 |
-
main()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|