Upload 3 files
Browse files- Capstone_model.h5 +3 -0
- app.py +34 -0
- requirements.txt +2 -0
Capstone_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:da54f1b3c01c21848716d266b5a8dfe044a6553b32bc7a519052556a61acff99
|
| 3 |
+
size 52334736
|
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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('Capstone_model.h5')
|
| 7 |
+
|
| 8 |
+
def process_image(img):
|
| 9 |
+
img=img.resize((100,100)) #boyutunu 170*170 pixel yaptık
|
| 10 |
+
img=np.array(img)
|
| 11 |
+
img=img/255.0 #Normalize ettik
|
| 12 |
+
img=np.expand_dims(img,axis=0)
|
| 13 |
+
return img
|
| 14 |
+
|
| 15 |
+
st.title('Alman Trafik Isiklarini Tahmin Etme')
|
| 16 |
+
st.write('Resim seç ve hangi trafik işareti olduğunu tahmin etsin')
|
| 17 |
+
|
| 18 |
+
file=st.file_uploader('Bir Resim Sec', type=['jpg','jpeg','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=['Speed limit (20km/h)','Speed limit (30km/h)', 'Speed limit (50km/h)', 'Speed limit (60km/h)', 'Speed limit (70km/h)', 'Speed limit (80km/h)',
|
| 28 |
+
'End of speed limit (80km/h)', 'Speed limit (100km/h)', 'Speed limit (120km/h)', 'No passing', 'No passing veh over 3.5 tons',
|
| 29 |
+
'Right-of-way at intersection', 'Priority road', 'Yield', 'Stop', 'No vehicles', 'Veh > 3.5 tons prohibited', 'No entry',
|
| 30 |
+
'General caution', 'Dangerous curve left', 'Dangerous curve right', 'Double curve', 'Bumpy road', 'Slippery road', 'Road narrows on the right',
|
| 31 |
+
'Road work', 'Traffic signals', 'Pedestrians', 'Children crossing', 'Bicycles crossing', 'Beware of ice/snow','Wild animals crossing',
|
| 32 |
+
'End speed + passing limits', 'Turn right ahead', 'Turn left ahead', 'Ahead only', 'Go straight or right', 'Go straight or left',
|
| 33 |
+
'Keep right', 'Keep left', 'Roundabout mandatory', 'End of no passing', 'End no passing veh > 3.5 tons']
|
| 34 |
+
st.write(class_names[predicted_class])
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
tensorflow
|