Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
|
|
2 |
import numpy as np
|
3 |
from PIL import Image
|
4 |
|
|
|
|
|
5 |
import tensorflow as tf
|
6 |
from hugsvision.inference.TorchVisionClassifierInference import TorchVisionClassifierInference
|
7 |
|
@@ -33,7 +35,7 @@ def predict_image(image, model_name):
|
|
33 |
image = np.array(image) / 255
|
34 |
image = np.expand_dims(image, axis=0)
|
35 |
|
36 |
-
model = "./models/" + model_name + "model.h5"
|
37 |
pred = model.predict(image)
|
38 |
|
39 |
pred = dict((labels[i], "%.2f" % pred[0][i]) for i in range(len(labels)))
|
|
|
2 |
import numpy as np
|
3 |
from PIL import Image
|
4 |
|
5 |
+
from tensorflow.keras import models
|
6 |
+
from tensorflow.keras.preprocessing.image import load_img
|
7 |
import tensorflow as tf
|
8 |
from hugsvision.inference.TorchVisionClassifierInference import TorchVisionClassifierInference
|
9 |
|
|
|
35 |
image = np.array(image) / 255
|
36 |
image = np.expand_dims(image, axis=0)
|
37 |
|
38 |
+
model = model = models.load_model("./models/" + model_name + "/model.h5")
|
39 |
pred = model.predict(image)
|
40 |
|
41 |
pred = dict((labels[i], "%.2f" % pred[0][i]) for i in range(len(labels)))
|