Spaces:
Build error
Build error
Upload 35 files
Browse files- .gitattributes +2 -0
- Arborio.png +0 -0
- Basmati.png +0 -0
- CYMK Color Channels Arborio.png +0 -0
- CYMK Color Channels Basmati.png +0 -0
- CYMK Color Channels Ipsala.png +0 -0
- CYMK Color Channels Jasmine.png +0 -0
- CYMK Color Channels Karacadag.png +0 -0
- Color Channels Arborio.png +0 -0
- Color Channels Basmati.png +0 -0
- Color Channels Ipsala.png +0 -0
- Color Channels Jasmine.png +0 -0
- Color Channels Karacadag.png +0 -0
- Color Dominance Arborio.png +0 -0
- Color Dominance Basmati.png +0 -0
- Color Dominance Ipsala.png +0 -0
- Color Dominance Jasmine.png +0 -0
- Color Dominance Karacadag.png +0 -0
- Ipsala.png +0 -0
- Jasmine.png +0 -0
- Karacadag.png +0 -0
- Tepi Gambar Arborio.png +0 -0
- Tepi Gambar Basmati.png +0 -0
- Tepi Gambar Ipsala.png +0 -0
- Tepi Gambar Jasmine.png +0 -0
- Tepi Gambar Karacadag.png +0 -0
- __pycache__/eda.cpython-311.pyc +0 -0
- __pycache__/eda.cpython-39.pyc +0 -0
- __pycache__/prediction.cpython-311.pyc +0 -0
- __pycache__/prediction.cpython-39.pyc +0 -0
- app.py +10 -0
- cnn_model.keras +3 -0
- eda.py +136 -0
- prediction.py +43 -0
- requirements.txt +6 -0
- wallpaper.jpg +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
cnn_model.keras filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
wallpaper.jpg filter=lfs diff=lfs merge=lfs -text
|
Arborio.png
ADDED
|
Basmati.png
ADDED
|
CYMK Color Channels Arborio.png
ADDED
|
CYMK Color Channels Basmati.png
ADDED
|
CYMK Color Channels Ipsala.png
ADDED
|
CYMK Color Channels Jasmine.png
ADDED
|
CYMK Color Channels Karacadag.png
ADDED
|
Color Channels Arborio.png
ADDED
|
Color Channels Basmati.png
ADDED
|
Color Channels Ipsala.png
ADDED
|
Color Channels Jasmine.png
ADDED
|
Color Channels Karacadag.png
ADDED
|
Color Dominance Arborio.png
ADDED
|
Color Dominance Basmati.png
ADDED
|
Color Dominance Ipsala.png
ADDED
|
Color Dominance Jasmine.png
ADDED
|
Color Dominance Karacadag.png
ADDED
|
Ipsala.png
ADDED
|
Jasmine.png
ADDED
|
Karacadag.png
ADDED
|
Tepi Gambar Arborio.png
ADDED
|
Tepi Gambar Basmati.png
ADDED
|
Tepi Gambar Ipsala.png
ADDED
|
Tepi Gambar Jasmine.png
ADDED
|
Tepi Gambar Karacadag.png
ADDED
|
__pycache__/eda.cpython-311.pyc
ADDED
|
Binary file (4.65 kB). View file
|
|
|
__pycache__/eda.cpython-39.pyc
ADDED
|
Binary file (2.54 kB). View file
|
|
|
__pycache__/prediction.cpython-311.pyc
ADDED
|
Binary file (6.32 kB). View file
|
|
|
__pycache__/prediction.cpython-39.pyc
ADDED
|
Binary file (1.39 kB). View file
|
|
|
app.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import eda
|
| 3 |
+
import prediction
|
| 4 |
+
|
| 5 |
+
page = st.sidebar.selectbox('Pilih halaman ', ('EDA', 'Prediction'))
|
| 6 |
+
|
| 7 |
+
if page == 'EDA':
|
| 8 |
+
eda.run()
|
| 9 |
+
else:
|
| 10 |
+
prediction.run()
|
cnn_model.keras
ADDED
|
@@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plotly.express as px
|
| 3 |
+
from PIL import Image
|
| 4 |
+
|
| 5 |
+
def run():
|
| 6 |
+
# Membuat judul
|
| 7 |
+
st.title('Rice Image Dataset')
|
| 8 |
+
|
| 9 |
+
# Membuat Sub Header
|
| 10 |
+
st.header('EDA Rice Image Dataset', divider='gray')
|
| 11 |
+
|
| 12 |
+
# Menambahkan Gambar
|
| 13 |
+
image = Image.open('wallpaper.jpg')
|
| 14 |
+
st.image(image, caption = 'Rice', channels='RGB')
|
| 15 |
+
|
| 16 |
+
# Menambahkan Divider
|
| 17 |
+
st.divider()
|
| 18 |
+
|
| 19 |
+
# Jenis - Jenis Beras
|
| 20 |
+
st.header('Jenis-Jenis Beras', divider='gray')
|
| 21 |
+
st.subheader('Arborio')
|
| 22 |
+
image = Image.open('Arborio.png')
|
| 23 |
+
st.image(image, channels='RGB')
|
| 24 |
+
|
| 25 |
+
st.subheader('Basmati')
|
| 26 |
+
image = Image.open('Basmati.png')
|
| 27 |
+
st.image(image, channels='RGB')
|
| 28 |
+
|
| 29 |
+
st.subheader('Ipsala')
|
| 30 |
+
image = Image.open('Ipsala.png')
|
| 31 |
+
st.image(image, channels='RGB')
|
| 32 |
+
|
| 33 |
+
st.subheader('Jasmine')
|
| 34 |
+
image = Image.open('Jasmine.png')
|
| 35 |
+
st.image(image, channels='RGB')
|
| 36 |
+
|
| 37 |
+
st.subheader('Karacadag')
|
| 38 |
+
image = Image.open('Karacadag.png')
|
| 39 |
+
st.image(image, channels='RGB')
|
| 40 |
+
st.divider()
|
| 41 |
+
|
| 42 |
+
# Tepi Gambar Beras
|
| 43 |
+
st.header('Tepi Gambar Beras', divider='gray')
|
| 44 |
+
st.subheader('Arborio')
|
| 45 |
+
image = Image.open('Tepi Gambar Arborio.png')
|
| 46 |
+
st.image(image, channels='RGB')
|
| 47 |
+
|
| 48 |
+
st.subheader('Basmati')
|
| 49 |
+
image = Image.open('Tepi Gambar Basmati.png')
|
| 50 |
+
st.image(image, channels='RGB')
|
| 51 |
+
|
| 52 |
+
st.subheader('Ipsala')
|
| 53 |
+
image = Image.open('Tepi Gambar Ipsala.png')
|
| 54 |
+
st.image(image, channels='RGB')
|
| 55 |
+
|
| 56 |
+
st.subheader('Jasmine')
|
| 57 |
+
image = Image.open('Tepi Gambar Jasmine.png')
|
| 58 |
+
st.image(image, channels='RGB')
|
| 59 |
+
|
| 60 |
+
st.subheader('Karacadag')
|
| 61 |
+
image = Image.open('Tepi Gambar Karacadag.png')
|
| 62 |
+
st.image(image, channels='RGB')
|
| 63 |
+
st.divider()
|
| 64 |
+
|
| 65 |
+
# Warna Dominan Beras
|
| 66 |
+
st.header('Warna Dominan Beras', divider='gray')
|
| 67 |
+
st.subheader('Arborio')
|
| 68 |
+
image = Image.open('Color Dominance Arborio.png')
|
| 69 |
+
st.image(image, channels='RGB')
|
| 70 |
+
|
| 71 |
+
st.subheader('Basmati')
|
| 72 |
+
image = Image.open('Color Dominance Basmati.png')
|
| 73 |
+
st.image(image, channels='RGB')
|
| 74 |
+
|
| 75 |
+
st.subheader('Ipsala')
|
| 76 |
+
image = Image.open('Color Dominance Ipsala.png')
|
| 77 |
+
st.image(image, channels='RGB')
|
| 78 |
+
|
| 79 |
+
st.subheader('Jasmine')
|
| 80 |
+
image = Image.open('Color Dominance Jasmine.png')
|
| 81 |
+
st.image(image, channels='RGB')
|
| 82 |
+
|
| 83 |
+
st.subheader('Karacadag')
|
| 84 |
+
image = Image.open('Color Dominance Karacadag.png')
|
| 85 |
+
st.image(image, channels='RGB')
|
| 86 |
+
st.divider()
|
| 87 |
+
|
| 88 |
+
# Color Channel RGB Beras
|
| 89 |
+
st.header('Warna Channel RGB Beras', divider='gray')
|
| 90 |
+
st.subheader('Arborio')
|
| 91 |
+
image = Image.open('Color Channels Arborio.png')
|
| 92 |
+
st.image(image, channels='RGB')
|
| 93 |
+
|
| 94 |
+
st.subheader('Basmati')
|
| 95 |
+
image = Image.open('Color Channels Basmati.png')
|
| 96 |
+
st.image(image, channels='RGB')
|
| 97 |
+
|
| 98 |
+
st.subheader('Ipsala')
|
| 99 |
+
image = Image.open('Color Channels Ipsala.png')
|
| 100 |
+
st.image(image, channels='RGB')
|
| 101 |
+
|
| 102 |
+
st.subheader('Jasmine')
|
| 103 |
+
image = Image.open('Color Channels Jasmine.png')
|
| 104 |
+
st.image(image, channels='RGB')
|
| 105 |
+
|
| 106 |
+
st.subheader('Karacadag')
|
| 107 |
+
image = Image.open('Color Channels Karacadag.png')
|
| 108 |
+
st.image(image, channels='RGB')
|
| 109 |
+
st.divider()
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
# Color Channel CYMK Beras
|
| 113 |
+
st.header('Warna Channel RGB Beras', divider='gray')
|
| 114 |
+
st.subheader('Arborio')
|
| 115 |
+
image = Image.open('CYMK Color Channels Arborio.png')
|
| 116 |
+
st.image(image, channels='RGB')
|
| 117 |
+
|
| 118 |
+
st.subheader('Basmati')
|
| 119 |
+
image = Image.open('CYMK Color Channels Basmati.png')
|
| 120 |
+
st.image(image, channels='RGB')
|
| 121 |
+
|
| 122 |
+
st.subheader('Ipsala')
|
| 123 |
+
image = Image.open('CYMK Color Channels Ipsala.png')
|
| 124 |
+
st.image(image, channels='RGB')
|
| 125 |
+
|
| 126 |
+
st.subheader('Jasmine')
|
| 127 |
+
image = Image.open('CYMK Color Channels Jasmine.png')
|
| 128 |
+
st.image(image, channels='RGB')
|
| 129 |
+
|
| 130 |
+
st.subheader('Karacadag')
|
| 131 |
+
image = Image.open('CYMK Color Channels Karacadag.png')
|
| 132 |
+
st.image(image, channels='RGB')
|
| 133 |
+
st.divider()
|
| 134 |
+
|
| 135 |
+
if __name__ == '__main__':
|
| 136 |
+
run()
|
prediction.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from PIL import Image
|
| 3 |
+
import numpy as np
|
| 4 |
+
from tensorflow.keras.models import load_model
|
| 5 |
+
from tensorflow.keras.preprocessing.image import img_to_array
|
| 6 |
+
|
| 7 |
+
# Function to preprocess the uploaded image
|
| 8 |
+
def preprocess_image(image):
|
| 9 |
+
img = image.resize((img_height, img_width))
|
| 10 |
+
img_array = img_to_array(img)
|
| 11 |
+
img_array = np.expand_dims(img_array, axis=0)
|
| 12 |
+
img_array /= 255.0
|
| 13 |
+
return img_array
|
| 14 |
+
|
| 15 |
+
# Mapping numerical predictions to class labels
|
| 16 |
+
class_labels = {0: "Arborio", 1: "Basmati", 2: "Ipsala", 3: "Jasmine", 4: "Karacadag"}
|
| 17 |
+
|
| 18 |
+
# Main function to run the Streamlit app
|
| 19 |
+
def main():
|
| 20 |
+
st.title("Rice Classifier")
|
| 21 |
+
st.write("Upload a picture of rice to predict its type..")
|
| 22 |
+
|
| 23 |
+
# File upload
|
| 24 |
+
uploaded_file = st.file_uploader("Select the rice image...", type=["jpg", "jpeg", "png"])
|
| 25 |
+
|
| 26 |
+
if uploaded_file is not None:
|
| 27 |
+
# Display the uploaded image
|
| 28 |
+
image = Image.open(uploaded_file)
|
| 29 |
+
st.image(image, caption="Gambar yang diunggah", use_column_width=True)
|
| 30 |
+
|
| 31 |
+
# Load the model (once the image is uploaded)
|
| 32 |
+
model = load_model("my_model.keras")
|
| 33 |
+
|
| 34 |
+
# Preprocess and predict
|
| 35 |
+
img_array = preprocess_image(image)
|
| 36 |
+
prediction = model.predict(img_array)
|
| 37 |
+
predicted_class = np.argmax(prediction, axis=1)[0]
|
| 38 |
+
|
| 39 |
+
# Display prediction
|
| 40 |
+
st.write(f'Prediksi: {class_labels[predicted_class]}')
|
| 41 |
+
|
| 42 |
+
if __name__ == "__main__":
|
| 43 |
+
main()
|
requirements.txt
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|
| 3 |
+
numpy
|
| 4 |
+
scikit.learn==1.3.0
|
| 5 |
+
tensorflow==2.15.0
|
| 6 |
+
tensorflow_hub==0.16.1
|
wallpaper.jpg
ADDED
|
Git LFS Details
|