-
Notifications
You must be signed in to change notification settings - Fork 182
/
Copy pathBreast_Cancer_Classifier_Web_App.py
52 lines (38 loc) · 1.45 KB
/
Breast_Cancer_Classifier_Web_App.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 8 22:59:27 2023
@author: HP
"""
import numpy as np
import pickle
import streamlit as st
#load the model
loaded_model = pickle.load(open("Breast_Cancer_Classifier.sav",'rb'))
def breast_cancer_classifer(input_data):
# changing the input_data to numpy array
input_data_as_numpy_array = np.asarray(input_data)
# reshape the array as we are predicting for one instance
input_data_reshaped = input_data_as_numpy_array.reshape(1,-1)
prediction = loaded_model.predict(input_data_reshaped)
print(prediction)
if (prediction[0] == 0):
return 'This is a Benign Tumour(Non-Cancerous)'
else:
return 'This is a Malignent Tumour(Cancerous)'
def main():
#giving a title
st.title('Breast Cancer Classifier Web App')
#getting input from the user
mean_radius = st.text_input("Mean Radius")
mean_texture = st.text_input("Mean Texture")
mean_perimeter = st.text_input("Mean Perimeter")
mean_area = st.text_input("Mean Area")
mean_smoothness = st.text_input("Mean Smoothness")
#code for prediction
diagnosis = ''
# getting the input data from the user
if st.button('Heart Disease Test Result : '):
diagnosis = breast_cancer_classifer([mean_radius,mean_texture,mean_perimeter,mean_area,mean_smoothness])
st.success(diagnosis)
if __name__ == "__main__":
main()