drmurataltun commited on
Commit
ad05d30
·
verified ·
1 Parent(s): f42a0df

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ import streamlit as st
5
+ from tensorflow.keras.models import load_model
6
+ from PIL import Image
7
+ import numpy as np
8
+ import cv2
9
+
10
+ model = load_model('Malaria_cnn.h5')
11
+
12
+ def process_image(img):
13
+ img = img.resize((30, 30))
14
+ img = np.array(img)
15
+ img = img / 255.0
16
+ img = np.expand_dims(img, axis=0)
17
+ return img
18
+
19
+ st.title('Malaria Parazit Tarama')
20
+ st.write('Resim seçin ve model tahmin etsin')
21
+
22
+ file = st.file_uploader('Bir resim seçin', type=['jpg', 'jpeg', 'png'])
23
+ class_names = ['Normal', 'Parazit']
24
+
25
+ if file is not None:
26
+ img = Image.open(file)
27
+ st.image(img, caption='Yüklenen resim')
28
+ image = process_image(img)
29
+ prediction = model.predict(image)
30
+ predicted_class = np.argmax(prediction)
31
+ st.write(class_names[predicted_class])