drmurataltun commited on
Commit
c41eff0
·
verified ·
1 Parent(s): 220e792

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +31 -0
  2. requirements.txt +2 -0
  3. veg_fruit_cnn.h5 +3 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+ #dosyayı py olarak kaydet ve komut satırını kullanarak streamlit run streamlit.py
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
+ model=load_model('veg_fruit_cnn.h5')
10
+ def process_image(img):
11
+ img=img.resize((170,170)) #boyutunu 170*170 yap
12
+ img=np.array(img)
13
+ img=img/255.0
14
+ img=np.expand_dims(img,axis=0)
15
+ return img
16
+ st.title('Meyve Sebze Sınıflandırma:fruit:')
17
+ st.write('Resim sec ve model kanser tahmin etsin')
18
+ file=st.file_uploader('Bir resim seç', type= ['jpg','jpeg','png'])
19
+ class_names=['elma', 'muz', 'pancar', 'dolmalık biber', 'lahana', 'kapya biber',
20
+ 'havuç', 'karnabahar', 'acı biber', 'mısır', 'salatalık',
21
+ 'patlıcan', 'sarımsak', 'zencefil', 'üzüm', 'jalapeno', 'kivi', 'limon',
22
+ 'marul', 'mango', 'soğan', 'portakal', 'paprika', 'armut', 'bezelye',
23
+ 'ananas', 'nar', 'patates', 'turp', 'soya fasulyesi', 'ıspanak',
24
+ 'tatlı mısır', 'tatlı patates', 'domates', 'şalgam', 'karpuz']
25
+ if file is not None:
26
+ img=Image.open(file)
27
+ st.image(img,caption='yuklenen resim')
28
+ image=process_image(img)
29
+ prediction=model.predict(image)
30
+ predicted_class=np.argmax(prediction)
31
+ st.write(class_names[predicted_class])
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ streamlit
2
+ tensorflow
veg_fruit_cnn.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c2fc924260dcf74fcf0c578f5759d288329877b509573f78f6e9b5e297dab8b4
3
+ size 165569000