Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
|
|
2 |
import pandas as np
|
3 |
from keras.models import model_from_json
|
4 |
from keras.preprocessing import image
|
|
|
5 |
import heapq
|
6 |
|
7 |
file = open("focusondriving.json", 'r')
|
@@ -27,7 +28,7 @@ def predict_image(pic):
|
|
27 |
img = image.load_img(pic, target_size=(224, 224))
|
28 |
x = image.img_to_array(img)
|
29 |
x = np.expand_dims(x, axis=0)
|
30 |
-
|
31 |
preds = loaded_model.predict(x)
|
32 |
preds = list(preds[0])
|
33 |
|
|
|
2 |
import pandas as np
|
3 |
from keras.models import model_from_json
|
4 |
from keras.preprocessing import image
|
5 |
+
from keras.applications.vgg16 import VGG16, preprocess_input
|
6 |
import heapq
|
7 |
|
8 |
file = open("focusondriving.json", 'r')
|
|
|
28 |
img = image.load_img(pic, target_size=(224, 224))
|
29 |
x = image.img_to_array(img)
|
30 |
x = np.expand_dims(x, axis=0)
|
31 |
+
x = preprocess_input(x)
|
32 |
preds = loaded_model.predict(x)
|
33 |
preds = list(preds[0])
|
34 |
|