Fatser commited on
Commit
5590921
·
verified ·
1 Parent(s): 447a556

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +35 -0
  2. rice.h5 +3 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from tensorflow.keras.models import load_model
3
+ from PIL import Image
4
+ import numpy as np
5
+
6
+ model=load_model("rice.h5")
7
+
8
+ def process_image(img):
9
+ img=img.resize((70,70))
10
+ img=np.array(img)
11
+ img=img/155.0
12
+ img=np.expand_dims(img,axis=0) # Modelin boyutunu arttırıyor
13
+ return img
14
+
15
+ st.title("Pirinc siniflandirma")
16
+ st.write("Resim sec ve model hangi tur pirinc oldugunu tahmin etsin")
17
+
18
+ file = st.file_uploader("Bir resim sec",type=["jpeg","jpg","png"])
19
+
20
+ if file is not None:
21
+ img=Image.open(file)
22
+ st.image(img,caption="yuklenen resim")
23
+ image=process_image(img)
24
+ prediction=model.predict(image)
25
+ predicted_class=np.argmax(prediction)
26
+
27
+ class_names={
28
+ 0: 'Arborio',
29
+ 1: 'Basmati',
30
+ 2: 'Ipsala',
31
+ 3: 'Jasmine',
32
+ 4: 'Karacadag'
33
+ }
34
+
35
+ st.write(class_names[predicted_class])
rice.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d5cf2f15037af1fb1d20124459578140fc5e4eb09d4e574b311089493a042d6
3
+ size 25999240