Spaces:
Sleeping
Sleeping
jordancaraballo
commited on
Commit
•
7103bb2
1
Parent(s):
04e1eea
Adding pages
Browse files- Home.py +67 -0
- pages/1_Show_Images.py +4 -0
- pages/2_Predict_Images.py +4 -0
Home.py
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from PIL import Image
|
3 |
+
import model as classify
|
4 |
+
import numpy as np
|
5 |
+
|
6 |
+
sign_names = {
|
7 |
+
0: 'Speed limit (20km/h)',
|
8 |
+
1: 'Speed limit (30km/h)',
|
9 |
+
2: 'Speed limit (50km/h)',
|
10 |
+
3: 'Speed limit (60km/h)',
|
11 |
+
4: 'Speed limit (70km/h)',
|
12 |
+
5: 'Speed limit (80km/h)',
|
13 |
+
6: 'End of speed limit (80km/h)',
|
14 |
+
7: 'Speed limit (100km/h)',
|
15 |
+
8: 'Speed limit (120km/h)',
|
16 |
+
9: 'No passing',
|
17 |
+
10: 'No passing for vehicles over 3.5 metric tons',
|
18 |
+
11: 'Right-of-way at the next intersection',
|
19 |
+
12: 'Priority road',
|
20 |
+
13: 'Yield',
|
21 |
+
14: 'Stop',
|
22 |
+
15: 'No vehicles',
|
23 |
+
16: 'Vehicles over 3.5 metric tons prohibited',
|
24 |
+
17: 'No entry',
|
25 |
+
18: 'General caution',
|
26 |
+
19: 'Dangerous curve to the left',
|
27 |
+
20: 'Dangerous curve to the right',
|
28 |
+
21: 'Double curve',
|
29 |
+
22: 'Bumpy road',
|
30 |
+
23: 'Slippery road',
|
31 |
+
24: 'Road narrows on the right',
|
32 |
+
25: 'Road work',
|
33 |
+
26: 'Traffic signals',
|
34 |
+
27: 'Pedestrians',
|
35 |
+
28: 'Children crossing',
|
36 |
+
29: 'Bicycles crossing',
|
37 |
+
30: 'Beware of ice/snow',
|
38 |
+
31: 'Wild animals crossing',
|
39 |
+
32: 'End of all speed and passing limits',
|
40 |
+
33: 'Turn right ahead',
|
41 |
+
34: 'Turn left ahead',
|
42 |
+
35: 'Ahead only',
|
43 |
+
36: 'Go straight or right',
|
44 |
+
37: 'Go straight or left',
|
45 |
+
38: 'Keep right',
|
46 |
+
39: 'Keep left',
|
47 |
+
40: 'Roundabout mandatory',
|
48 |
+
41: 'End of no passing',
|
49 |
+
42: 'End of no passing by vehicles over 3.5 metric tons'}
|
50 |
+
|
51 |
+
st.title("Traffic Sign Classifier")
|
52 |
+
|
53 |
+
uploaded_file = st.file_uploader("Choose an image...", type="jpg")
|
54 |
+
if uploaded_file is not None:
|
55 |
+
|
56 |
+
image = Image.open(uploaded_file)
|
57 |
+
st.image(image, caption='Uploaded Image', use_column_width=True)
|
58 |
+
|
59 |
+
st.write("")
|
60 |
+
|
61 |
+
if st.button('predict'):
|
62 |
+
st.write("Result...")
|
63 |
+
#label = classify.predict(uploaded_file)
|
64 |
+
#label = label.item()
|
65 |
+
|
66 |
+
#res = sign_names.get(label)
|
67 |
+
#st.markdown(res)
|
pages/1_Show_Images.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
x = st.slider('Select a value')
|
4 |
+
st.write(x, 'squared is', x * x)
|
pages/2_Predict_Images.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
|
3 |
+
x = st.slider('Select a value')
|
4 |
+
st.write(x, 'squared is', x * x)
|