Spaces:
Sleeping
Sleeping
import streamlit as st | |
from PIL import Image | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
st.title("BREAST CANCER BEGNIN or MALIGNANT CLASSIFICATION") | |
st.write("19CSE363 : ARTIFICIAL INTELLIGENCE") | |
st.write("DATASET : CBIS_DDSM") | |
model = tf.keras.models.load_model('custom_final_new_upt.h5') | |
uploaded_file = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"]) | |
if uploaded_file is not None: | |
image = Image.open(uploaded_file) | |
st.image(image, caption="Uploaded Image", use_column_width=True) | |
image = image.convert("RGB") | |
img = image.resize((150, 150)) | |
img_array = np.array(img) | |
img_array = img_array.astype('float32') / 255.0 | |
img_array = np.expand_dims(img_array, axis=0) | |
predictions = model.predict(img_array) | |
class_names = ['Begnin', 'Malignant'] | |
predicted_class = class_names[np.argmax(predictions)] | |
st.write(f"Prediction: {predicted_class}") | |