Metinhsimi commited on
Commit
0fd605a
·
verified ·
1 Parent(s): 96ad19b

Upload 4 files

Browse files
Files changed (4) hide show
  1. Malaria_CNN.ipynb +0 -0
  2. appp.py +56 -0
  3. model95.h5 +3 -0
  4. requirements.txt +2 -0
Malaria_CNN.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
appp.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from PIL import Image
3
+ import numpy as np
4
+ from tensorflow.keras.models import load_model
5
+
6
+ # Hastalık sınıfları
7
+ sınıflar = ['Hastalıklı', 'Sağlıklı']
8
+
9
+ # Modeli yükleme
10
+ model = load_model('model95.h5') # Modelinizin yolunu buraya ekleyin
11
+ model.summary()
12
+
13
+ def process_img(img):
14
+ img = img.resize((128, 128), Image.LANCZOS) # 128x128 piksel boyutuna dönüştürme
15
+ img = np.array(img) / 255.0 # Normalize etme
16
+ img = np.expand_dims(img, axis=0) # Resme boyut ekleme
17
+ return img
18
+
19
+ st.title("Malaria Hastalığı Sınıflandırması :date:")
20
+ st.write(
21
+ "Bir mikroskop resmi seçin ve modelimiz, bu resmin **Malaria** hastalığı gösterip göstermediğini tahmin etsin. 🖼️📊\n"
22
+ "Upload an image and the model will predict whether the image shows **Malaria** or not."
23
+ )
24
+
25
+ # Stil ayarları
26
+ st.markdown("""
27
+ <style>
28
+ .reportview-container {
29
+ background: #F0F2F6;
30
+ }
31
+ .sidebar .sidebar-content {
32
+ background: #E0E0E0;
33
+ }
34
+ .css-18e3th9 {
35
+ font-size: 1.25em;
36
+ color: #333;
37
+ }
38
+ </style>
39
+ """, unsafe_allow_html=True)
40
+
41
+ file = st.file_uploader("Resim Yükle & Bir resim seçiniz", type=['png', 'jpg', 'jpeg'])
42
+
43
+ if file is not None:
44
+ img = Image.open(file)
45
+ st.image(img, caption="Yüklenen Resim", use_column_width=True)
46
+
47
+ result = process_img(img)
48
+ prediction = model.predict(result)
49
+ prediction_class = np.argmax(prediction) # En yüksek tahmin edilen sınıf
50
+
51
+ # Sınıf isimleri
52
+ result_text = sınıflar[prediction_class]
53
+
54
+ st.write(f"**Sonuç:** {result_text}")
55
+ else:
56
+ st.write("Lütfen bir resim yükleyin.")
model95.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:79b498f8ab4000bf0f85e6cb47596d3a9316264c38cbca114173b30bd0769d3a
3
+ size 12817368
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ tensorflow
2
+ streamlit