Spaces:
Runtime error
Runtime error
Soham Chandratre
commited on
Commit
Β·
bfa893d
1
Parent(s):
e6030dc
minor changes
Browse files
model/keras_model.h5 β keras_model.h5
RENAMED
|
File without changes
|
model/labels.txt β labels.txt
RENAMED
|
File without changes
|
model/pothole_model.py
CHANGED
|
@@ -23,10 +23,12 @@
|
|
| 23 |
# return predicted_class
|
| 24 |
|
| 25 |
|
| 26 |
-
|
| 27 |
-
from PIL import Image, ImageOps
|
| 28 |
import numpy as np
|
|
|
|
| 29 |
from io import BytesIO
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
|
|
@@ -34,11 +36,11 @@ def load_image_model(image):
|
|
| 34 |
# Disable scientific notation for clarity
|
| 35 |
np.set_printoptions(suppress=True)
|
| 36 |
|
| 37 |
-
# Load the model
|
| 38 |
-
model = load_model("
|
| 39 |
|
| 40 |
# Load the labels
|
| 41 |
-
class_names = open("
|
| 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
|
|
|
|
| 23 |
# return predicted_class
|
| 24 |
|
| 25 |
|
| 26 |
+
import tensorflow as tf
|
| 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 |
# Disable scientific notation for clarity
|
| 37 |
np.set_printoptions(suppress=True)
|
| 38 |
|
| 39 |
+
# Load the model from the URL
|
| 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
|