Skin_Cancer_Classification / src /streamlit_app.py
Harun01's picture
Update src/streamlit_app.py
3eebb9e verified
raw
history blame contribute delete
879 Bytes
import streamlit as st
from tensorflow.keras.models import load_model
from PIL import Image
import numpy as np
# ✅ Doğru dosya yolu
model = load_model('src/my_cnn_model.h5')
class_names = ['Kanser Değil', 'Kanser']
def process_image(img):
img = img.resize((170,170))
img = np.array(img) / 255.0
img = np.expand_dims(img, axis=0)
return img
st.title("🧬 Cilt Kanseri Sınıflandırıcı")
st.write("Bir cilt görseli yükleyin, 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).convert("RGB")
st.image(img, caption='Yüklenen Resim', use_container_width=True)
image = process_image(img)
prediction = model.predict(image)
predicted_class = np.argmax(prediction)
st.success(f"Tahmin: {class_names[predicted_class]}")