rishabh5752 commited on
Commit
af273bd
1 Parent(s): 746f9e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -1,10 +1,12 @@
1
  import streamlit as st
2
  import pandas as pd
3
  import pickle
 
 
4
 
5
  # Load the pre-trained model
6
  with open('model.pkl', 'rb') as file:
7
- model = pickle.load(file, encoding='latin1')
8
 
9
  # Default parameter values
10
  default_values = [17.99, 10.38, 122.8, 1001, 0.1184, 0.2776, 0.3001, 0.1471, 0.2419, 0.07871,
@@ -36,3 +38,17 @@ if user_input.form_submit_button('Predict'):
36
  prediction_label = 'Malignant' if prediction[0] == 1 else 'Benign'
37
  st.subheader('Prediction')
38
  st.write(f'The lesion is predicted to be: {prediction_label}')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
  import pandas as pd
3
  import pickle
4
+ from tensorflow.keras.models import Sequential
5
+ from tensorflow.keras.layers import Dense, Dropout, Activation
6
 
7
  # Load the pre-trained model
8
  with open('model.pkl', 'rb') as file:
9
+ model = pickle.load(file)
10
 
11
  # Default parameter values
12
  default_values = [17.99, 10.38, 122.8, 1001, 0.1184, 0.2776, 0.3001, 0.1471, 0.2419, 0.07871,
 
38
  prediction_label = 'Malignant' if prediction[0] == 1 else 'Benign'
39
  st.subheader('Prediction')
40
  st.write(f'The lesion is predicted to be: {prediction_label}')
41
+
42
+ # Implementing ANN
43
+ ann_model = Sequential()
44
+ ann_model.add(Dense(16, input_dim=30, activation='relu'))
45
+ ann_model.add(Dropout(0.2))
46
+ ann_model.add(Dense(1, activation='sigmoid'))
47
+
48
+ # Compiling the model
49
+ ann_model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
50
+
51
+ # Model summary
52
+ st.subheader('Artificial Neural Network Model Summary')
53
+ with st.echo():
54
+ ann_model.summary()