Update app.py
Browse files
app.py
CHANGED
|
@@ -19,40 +19,39 @@ class_names = [ "Speed limit (20 km/h)",
|
|
| 19 |
"End of speed limit (80 km/h)",
|
| 20 |
"Speed limit (100 km/h)",
|
| 21 |
"Speed limit (120 km/h)",
|
| 22 |
-
"No
|
| 23 |
-
"No
|
| 24 |
-
"
|
|
|
|
| 25 |
"Yield",
|
| 26 |
-
"Stop",
|
| 27 |
-
"No entry",
|
| 28 |
"No vehicles",
|
| 29 |
-
"
|
| 30 |
-
"
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
-
"Dangerous curve
|
| 34 |
-
"Dangerous curve to the right",
|
| 35 |
"Double curve",
|
| 36 |
"Bumpy road",
|
| 37 |
"Slippery road",
|
| 38 |
"Road narrows on the right",
|
| 39 |
-
"
|
| 40 |
"Traffic signals",
|
| 41 |
-
"
|
| 42 |
-
"
|
| 43 |
-
"
|
| 44 |
-
"
|
| 45 |
-
"No parking",
|
| 46 |
-
"No stopping",
|
| 47 |
-
"No pedestrians",
|
| 48 |
"Wild animals crossing",
|
| 49 |
-
"End
|
| 50 |
"Turn right ahead",
|
| 51 |
"Turn left ahead",
|
| 52 |
"Ahead only",
|
| 53 |
"Go straight or right",
|
| 54 |
"Go straight or left",
|
| 55 |
-
"Keep right"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
# Preprocessing function
|
| 58 |
def preprocess_image(image):
|
|
@@ -77,7 +76,7 @@ def classify_image(image):
|
|
| 77 |
# Get the class name
|
| 78 |
class_name = class_names[predicted_class]
|
| 79 |
|
| 80 |
-
return f"Predicted Class: {predicted_class}"
|
| 81 |
|
| 82 |
# Create Gradio interface
|
| 83 |
interface = gr.Interface(
|
|
|
|
| 19 |
"End of speed limit (80 km/h)",
|
| 20 |
"Speed limit (100 km/h)",
|
| 21 |
"Speed limit (120 km/h)",
|
| 22 |
+
"No passing",
|
| 23 |
+
"No passing veh over 3.5 tons",
|
| 24 |
+
"Right-of-way at intersection",
|
| 25 |
+
"Priority road",
|
| 26 |
"Yield",
|
|
|
|
|
|
|
| 27 |
"No vehicles",
|
| 28 |
+
"Veh > 3.5 tons prohibited",
|
| 29 |
+
"No entry",
|
| 30 |
+
"General caution",
|
| 31 |
+
"Dangerous curve left",
|
| 32 |
+
"Dangerous curve right",
|
|
|
|
| 33 |
"Double curve",
|
| 34 |
"Bumpy road",
|
| 35 |
"Slippery road",
|
| 36 |
"Road narrows on the right",
|
| 37 |
+
"Road work",
|
| 38 |
"Traffic signals",
|
| 39 |
+
"Pedestrians",
|
| 40 |
+
"Children crossing",
|
| 41 |
+
"Bicycles crossing",
|
| 42 |
+
"Beware of ice/snow",
|
|
|
|
|
|
|
|
|
|
| 43 |
"Wild animals crossing",
|
| 44 |
+
"End speed + passing limits",
|
| 45 |
"Turn right ahead",
|
| 46 |
"Turn left ahead",
|
| 47 |
"Ahead only",
|
| 48 |
"Go straight or right",
|
| 49 |
"Go straight or left",
|
| 50 |
+
"Keep right",
|
| 51 |
+
"Keep left",
|
| 52 |
+
"Roundabout mandatory",
|
| 53 |
+
"End of no passing",
|
| 54 |
+
"End no passing veh > 3.5 tons"] # Update this with your classes
|
| 55 |
|
| 56 |
# Preprocessing function
|
| 57 |
def preprocess_image(image):
|
|
|
|
| 76 |
# Get the class name
|
| 77 |
class_name = class_names[predicted_class]
|
| 78 |
|
| 79 |
+
return f"Predicted Class: {class_name[predicted_class]}"
|
| 80 |
|
| 81 |
# Create Gradio interface
|
| 82 |
interface = gr.Interface(
|