Adityaswara
commited on
Commit
•
dd6c990
1
Parent(s):
ab4e780
first
Browse files- .gitattributes +1 -0
- app.py +24 -0
- distribusiLabel.png +0 -0
- eda.py +48 -0
- gambarLabel.png +0 -0
- model_ann_sequential_improve.keras +3 -0
- prediction.py +49 -0
- requirements.txt +8 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ 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 |
+
model_ann_sequential_improve.keras filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Import Library
|
2 |
+
import streamlit as st
|
3 |
+
|
4 |
+
# Import halaman streamlit yang sudah dibuat
|
5 |
+
import eda
|
6 |
+
import prediction
|
7 |
+
|
8 |
+
# Tombol navigasi
|
9 |
+
navigasi = st.sidebar.selectbox('Select Page :',
|
10 |
+
('Home Page','EDA','Sign Language Gesture Prediction'))
|
11 |
+
st.write('---')
|
12 |
+
|
13 |
+
if navigasi == 'Home Page':
|
14 |
+
st.header('Home Page')
|
15 |
+
st.write('---')
|
16 |
+
st.write('Creator : Muhammad Hafidz Adityaswara')
|
17 |
+
st.write('From : HCK - 012')
|
18 |
+
st.write('---')
|
19 |
+
|
20 |
+
|
21 |
+
elif navigasi == 'Sign Language Gesture Prediction':
|
22 |
+
prediction.run()
|
23 |
+
else :
|
24 |
+
eda.run()
|
distribusiLabel.png
ADDED
eda.py
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# import library
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
import streamlit as st
|
5 |
+
|
6 |
+
# library for visualization
|
7 |
+
import matplotlib.pyplot as plt
|
8 |
+
import seaborn as sns
|
9 |
+
import plotly.express as px
|
10 |
+
|
11 |
+
# Function untuk menjalankan streamlit model prediksi
|
12 |
+
def run():
|
13 |
+
# Title
|
14 |
+
st.title('Exploratory Data Analysis (EDA)')
|
15 |
+
st.write('---')
|
16 |
+
|
17 |
+
# Judul visualisasi 1
|
18 |
+
st.write('### Distribusi label')
|
19 |
+
|
20 |
+
st.image('distribusiLabel.png')
|
21 |
+
st.write('---')
|
22 |
+
|
23 |
+
# Judul visualisasi 2
|
24 |
+
st.write('### Gambar Sign Language Gesture')
|
25 |
+
|
26 |
+
st.image('gambarLabel.png')
|
27 |
+
st.write('---')
|
28 |
+
|
29 |
+
# Create by Hafidz
|
30 |
+
st.markdown(
|
31 |
+
"""
|
32 |
+
<style>
|
33 |
+
.right-align {
|
34 |
+
text-align: right;
|
35 |
+
}
|
36 |
+
</style>
|
37 |
+
""",
|
38 |
+
unsafe_allow_html=True
|
39 |
+
)
|
40 |
+
st.markdown(
|
41 |
+
"<p class='right-align'>Created by Muhammad Hafidz Adityaswara</p>",
|
42 |
+
unsafe_allow_html=True
|
43 |
+
)
|
44 |
+
|
45 |
+
|
46 |
+
# Menjalankan perintah setelah halaman terbuka
|
47 |
+
if __name__ == "__main__":
|
48 |
+
run()
|
gambarLabel.png
ADDED
model_ann_sequential_improve.keras
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:851e45001e4583af81612f9bb6d9034c9079394a89916c45e216bd8fcb1228ee
|
3 |
+
size 49899635
|
prediction.py
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#import library
|
2 |
+
import pandas as pd
|
3 |
+
import numpy as np
|
4 |
+
import streamlit as st
|
5 |
+
from tensorflow.keras.preprocessing.image import load_img, img_to_array
|
6 |
+
import matplotlib.pyplot as plt
|
7 |
+
from PIL import Image
|
8 |
+
import tensorflow as tf
|
9 |
+
from tensorflow.keras.models import load_model
|
10 |
+
|
11 |
+
#import pickle
|
12 |
+
import pickle
|
13 |
+
|
14 |
+
#load model
|
15 |
+
def run():
|
16 |
+
file = st.file_uploader("Upload an image", type=["jpg", "png"])
|
17 |
+
|
18 |
+
model = tf.keras.models.load_model('model_ann_sequential_improve.keras')
|
19 |
+
target_size=(50, 50)
|
20 |
+
|
21 |
+
def import_and_predict(image_data, model):
|
22 |
+
image = tf.keras.utils.load_img(image_data, target_size=(50, 50))
|
23 |
+
x = tf.keras.utils.img_to_array(image)
|
24 |
+
x = np.expand_dims(x, axis=0)
|
25 |
+
|
26 |
+
plt.imshow(image)
|
27 |
+
plt.axis('off')
|
28 |
+
plt.show()
|
29 |
+
|
30 |
+
# Make prediction
|
31 |
+
classes = model.predict(x)
|
32 |
+
result_pred = np.argmax(classes, axis=1)
|
33 |
+
labels = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
34 |
+
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
|
35 |
+
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
36 |
+
'U', 'V', 'W', 'X', 'Y', 'Z', '_']
|
37 |
+
|
38 |
+
predicted_class = labels[result_pred[0]] # Get the predicted class
|
39 |
+
return f"Prediction: {predicted_class}"
|
40 |
+
|
41 |
+
if file is None:
|
42 |
+
st.text("Please upload an image file")
|
43 |
+
else:
|
44 |
+
prediction = import_and_predict(file, model)
|
45 |
+
st.image(file)
|
46 |
+
st.write(prediction, font="Arial", size=50) # Increase text size
|
47 |
+
|
48 |
+
if __name__ == "__main__":
|
49 |
+
run()
|
requirements.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
seaborn
|
3 |
+
matplotlib
|
4 |
+
pickleshare
|
5 |
+
plotly
|
6 |
+
scikit-learn==1.3.0
|
7 |
+
tensorflow==2.15.0
|
8 |
+
PIL
|