import streamlit as st from tensorflow.keras.models import load_model from PIL import Image import numpy as np model = load_model('cnn_model_epoch_100.h5') def process_image(img): img = img.resize((170, 170)) # Boyutu 170x170 piksel yaptık img = np.array(img) / 255.0 # Normalize ettik img = np.expand_dims(img, axis=0) # 0. ortada olsun diye sayfada st.title('Kanser Resmi sınıflandırma :cancer:') img_file = st.file_uploader('Bir Resim Seç', type=['jpeg', 'png']) if img_file is not None: img = Image.open(img_file) st.image(img, caption='Yüklenen resim') prediction = model.predict(img) st.title('Kanser Resmi Sınıflandırma :cancer:') st.write('Resim seç ve model kanser olup olmadığını tahmin etsin.') file = st.file_uploader('Bir Resim Seç', type=['jpg', 'jpeg', 'png']) if file is not None: img = Image.open(file) st.image(img, caption='Yüklenen resim') image = process_image(img) prediction = model.predict(image) predicted_class = np.argmax(prediction) class_names = ['Kanser Değil', 'Kanser'] st.write(class_names[predicted_class])