Spaces:
Sleeping
Sleeping
Delete app_2.py
Browse files
app_2.py
DELETED
|
@@ -1,35 +0,0 @@
|
|
| 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_2.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])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|