Spaces:
Runtime error
Runtime error
Fixing input shape
Browse files
app.py
CHANGED
|
@@ -15,7 +15,9 @@ labels = [x for x in response.text.split("\n") if x != ""]
|
|
| 15 |
model = pull_from_hub(repo_id="Dimitre/mobilenet_v3_small")
|
| 16 |
|
| 17 |
def preprocess(image):
|
| 18 |
-
image
|
|
|
|
|
|
|
| 19 |
return image / 255.
|
| 20 |
|
| 21 |
def postprocess(prediction):
|
|
@@ -23,7 +25,7 @@ def postprocess(prediction):
|
|
| 23 |
|
| 24 |
def predict_fn(image):
|
| 25 |
image = preprocess(image)
|
| 26 |
-
prediction = model(image)
|
| 27 |
scores = postprocess(prediction)
|
| 28 |
return scores
|
| 29 |
|
|
|
|
| 15 |
model = pull_from_hub(repo_id="Dimitre/mobilenet_v3_small")
|
| 16 |
|
| 17 |
def preprocess(image):
|
| 18 |
+
print(image.shape)
|
| 19 |
+
# image = image.reshape((-1, 224, 224, 3))
|
| 20 |
+
# print(image.shape)
|
| 21 |
return image / 255.
|
| 22 |
|
| 23 |
def postprocess(prediction):
|
|
|
|
| 25 |
|
| 26 |
def predict_fn(image):
|
| 27 |
image = preprocess(image)
|
| 28 |
+
prediction = model([image])
|
| 29 |
scores = postprocess(prediction)
|
| 30 |
return scores
|
| 31 |
|