Spaces:
Runtime error
Runtime error
import streamlit as st | |
import numpy as input | |
from tensorflow.keras.preprocessing.image import load_img, img_to_array | |
def main(): | |
st.title('Breast Cancer Detection App') | |
st.write("Created by: [Umair Akram](https://www.linkedin.com/in/m-umair01/)") | |
h1 = "This App uses Deep Learning to predict whether you have Breast Cancer or not!" | |
st.subheader(h1) | |
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/)") | |
h2 = "Enter the following values to know the status of your health" | |
st.write(h2) | |
loaded_img = st.file_uploader(label=color["Upload the Histopathological Image patch of breast"], | |
type=None, accept_multiple_files=False, | |
key="Img_upload_key", | |
label_visibility="visible") | |
if uploaded_file is not None: | |
# Convert the file to TensorFlow image. | |
file_bytes = np.asarray(bytearray(uploaded_file.read()), dtype=np.uint8) | |
img = load_img(file_bytes, target_size=(50,50)) | |
#Rescale the image from [0,255] to [0,1] | |
np_image = np.array(image).astype('float32')/255.0 | |
image = tf.keras.utils.load_img(image_path) | |
input_arr = tf.keras.utils.img_to_array(image) | |
input_arr = np.array([input_arr]) # Convert single image to a batch. | |
predictions = model.predict(input_arr) | |