Spaces:
Sleeping
Sleeping
aliicemill
commited on
Commit
•
70bbfac
1
Parent(s):
3591327
Upload 3 files
Browse files- app.py +27 -0
- requirements.txt +3 -0
- rice_class_cnn.h5 +3 -0
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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('rice_class_cnn.h5')
|
10 |
+
def process_image(img):
|
11 |
+
img=img.resize((224,224))
|
12 |
+
img=np.array(img)
|
13 |
+
img=img/255.0
|
14 |
+
img=np.expand_dims(img,axis=0)
|
15 |
+
return img
|
16 |
+
st.title('prinç sınıflandırma')
|
17 |
+
st.write('Resim sec ve model tahmin etsin')
|
18 |
+
file=st.file_uploader('Bir resim seç', type= ['jpg','jpeg','png'])
|
19 |
+
class_names=['Arborio','Basmati','Ipsala','Jasmine','Karacadag']
|
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 |
+
st.write(prediction)
|
27 |
+
st.write('Tahmin: ',class_names[predicted_class])
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
tensorflow
|
3 |
+
opencv-python
|
rice_class_cnn.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ff1b03a47bce3316be7b22c3ed4062fbdf0340181114f9a4172228e5d1904dd1
|
3 |
+
size 61334376
|