| import streamlit as st |
| from tensorflow.keras.models import load_model |
| from PIL import Image |
| import numpy as np |
|
|
| |
| model = load_model('malaria_model.keras') |
|
|
| def process_image(img): |
| |
| img = img.convert('RGB') |
| img = img.resize((64, 64)) |
| img = np.array(img) |
| img = img / 255.0 |
| img = np.expand_dims(img, axis=0) |
| return img |
|
|
| st.title('Sıtma Resmi Sınıflandırma :microscope:') |
| st.write('Bir resim yükleyin, modelin sıtma olup olmadığını tahmin etmesini sağlayın!') |
|
|
| file = st.file_uploader('Bir resim yükle', type=['jpg', 'jpeg', 'png']) |
|
|
| if file is not None: |
| img = Image.open(file) |
| st.image(img, caption='Yüklenen Resim', use_column_width=True) |
|
|
| image = process_image(img) |
|
|
| prediction = model.predict(image)[0][0] |
|
|
| |
| st.write(f"Modelin Sıtma Olma Olasılığı: %{prediction * 100:.2f}") |
|
|
|
|
| predicted_class = 1 if prediction > 0.5 else 0 |
| class_names = ['Sıtma Yok', 'Sıtma Var'] |
| st.write(class_names[predicted_class]) |