Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- Vehice_detection.h5 +3 -0
- app.py +28 -0
- requirements.txt +2 -0
Vehice_detection.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:03412eee59a5234dc23bcc30aa0668b4aa095a18322f56596f028cbaf42e8591
|
3 |
+
size 77347344
|
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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('Vehice_detection.h5')
|
7 |
+
|
8 |
+
def process_image(img):
|
9 |
+
img=img.resize((120,120)) #boyutunu 120*120 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('Vehicle vs Non-Vehicle')
|
16 |
+
st.write("Choose a picture and guess whether it's a vehicle or Not Vehicle")
|
17 |
+
|
18 |
+
file=st.file_uploader('Choose a picture', type=['jpg','jpeg','png'])
|
19 |
+
|
20 |
+
if file is not None:
|
21 |
+
img=Image.open(file)
|
22 |
+
st.image(img,caption='uploaded image')
|
23 |
+
image=process_image(img)
|
24 |
+
prediction=model.predict(image)
|
25 |
+
predicted_class=np.argmax(prediction)
|
26 |
+
|
27 |
+
class_names=['non-vehicles','vehicles']
|
28 |
+
st.write(class_names[predicted_class])
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
streamlit
|
2 |
+
tensorflow
|