Spaces:
Sleeping
Sleeping
Soham Chandratre
commited on
Commit
Β·
e6030dc
1
Parent(s):
4dc6bee
minor changes
Browse files
model/__pycache__/pothole_model.cpython-311.pyc
CHANGED
Binary files a/model/__pycache__/pothole_model.cpython-311.pyc and b/model/__pycache__/pothole_model.cpython-311.pyc differ
|
|
keras_model.h5 β model/keras_model.h5
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
size 2453432
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e371d10c84ec45c9a2009e84e7a60cbf79726a71403908339fc08f37df7557a7
|
3 |
size 2453432
|
labels.txt β model/labels.txt
RENAMED
File without changes
|
model/pothole_model.py
CHANGED
@@ -23,12 +23,10 @@
|
|
23 |
# return predicted_class
|
24 |
|
25 |
|
26 |
-
import
|
27 |
-
from PIL import Image, ImageOps
|
28 |
import numpy as np
|
29 |
-
import requests
|
30 |
from io import BytesIO
|
31 |
-
from keras.models import load_model
|
32 |
|
33 |
|
34 |
|
@@ -36,11 +34,11 @@ def load_image_model(image):
|
|
36 |
# Disable scientific notation for clarity
|
37 |
np.set_printoptions(suppress=True)
|
38 |
|
39 |
-
# Load the model
|
40 |
-
model = load_model("keras_model.h5", compile=False)
|
41 |
|
42 |
# Load the labels
|
43 |
-
class_names = open("labels.txt", "r").readlines()
|
44 |
|
45 |
# Create the array of the right shape to feed into the keras model
|
46 |
# The 'length' or number of images you can put into the array is
|
|
|
23 |
# return predicted_class
|
24 |
|
25 |
|
26 |
+
from keras.models import load_model # TensorFlow is required for Keras to work
|
27 |
+
from PIL import Image, ImageOps # Install pillow instead of PIL
|
28 |
import numpy as np
|
|
|
29 |
from io import BytesIO
|
|
|
30 |
|
31 |
|
32 |
|
|
|
34 |
# Disable scientific notation for clarity
|
35 |
np.set_printoptions(suppress=True)
|
36 |
|
37 |
+
# Load the model
|
38 |
+
model = load_model("model\keras_model.h5", compile=False)
|
39 |
|
40 |
# Load the labels
|
41 |
+
class_names = open("model\labels.txt", "r").readlines()
|
42 |
|
43 |
# Create the array of the right shape to feed into the keras model
|
44 |
# The 'length' or number of images you can put into the array is
|
routes/__pycache__/route.cpython-311.pyc
CHANGED
Binary files a/routes/__pycache__/route.cpython-311.pyc and b/routes/__pycache__/route.cpython-311.pyc differ
|
|
routes/route.py
CHANGED
@@ -264,11 +264,11 @@ async def verify_pothole(potholeModel: PotholeModel, token: HTTPAuthorizationCre
|
|
264 |
# Pass image bytes to your model function
|
265 |
results = load_image_model(image_bytes)
|
266 |
|
267 |
-
if results ==
|
268 |
-
|
269 |
-
else:
|
270 |
-
|
271 |
-
|
272 |
except Exception as e:
|
273 |
return JSONResponse(content={"response": f"{e}"})
|
274 |
|
|
|
264 |
# Pass image bytes to your model function
|
265 |
results = load_image_model(image_bytes)
|
266 |
|
267 |
+
# if results == 'pothple':
|
268 |
+
# return JSONResponse(content={"response": "Pothole"})
|
269 |
+
# else:
|
270 |
+
# return JSONResponse(content={"response": "notPothole"})
|
271 |
+
return JSONResponse(content={"response": {results}})
|
272 |
except Exception as e:
|
273 |
return JSONResponse(content={"response": f"{e}"})
|
274 |
|