MUmairAB commited on
Commit
aed0572
1 Parent(s): a3a75cc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import numpy as input
3
+ from tensorflow.keras.preprocessing.image import load_img, img_to_array
4
+
5
+
6
+ def main():
7
+
8
+ st.title('Breast Cancer Detection App')
9
+ st.write("Created by: [Umair Akram](https://www.linkedin.com/in/m-umair01/)")
10
+
11
+ h1 = "This App uses Deep Learning to predict whether you have Breast Cancer or not!"
12
+ st.subheader(h1)
13
+ st.write("The model is built using Convolutional Neural Network (CNN) in TensorFlow. Its code and other interesting projects are available on my [website](https://mumairab.github.io/)")
14
+
15
+ h2 = "Enter the following values to know the status of your health"
16
+ st.write(h2)
17
+ loaded_img = st.file_uploader(label=color["Upload the Histopathological Image patch of breast"],
18
+ type=None, accept_multiple_files=False,
19
+ key="Img_upload_key",
20
+ label_visibility="visible")
21
+
22
+ if uploaded_file is not None:
23
+ # Convert the file to TensorFlow image.
24
+ file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8)
25
+ img = load_img(file_bytes, target_size=(50,50))
26
+ #Rescale the image from [0,255] to [0,1]
27
+ np_image = np.array(image).astype('float32')/255.0
28
+
29
+ image = tf.keras.utils.load_img(image_path)
30
+ input_arr = tf.keras.utils.img_to_array(image)
31
+ input_arr = np.array([input_arr]) # Convert single image to a batch.
32
+ predictions = model.predict(input_arr)
33
+