Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,7 +26,7 @@ async def root():
|
|
| 26 |
@app.post("/predict")
|
| 27 |
async def predict(file: UploadFile = File(...)):
|
| 28 |
try:
|
| 29 |
-
image = Image.open(file.file).convert("RGB").resize((
|
| 30 |
img_array = np.expand_dims(np.array(image) / 255.0, axis=0)
|
| 31 |
prediction = model.predict(img_array)
|
| 32 |
result = int(np.argmax(prediction))
|
|
|
|
| 26 |
@app.post("/predict")
|
| 27 |
async def predict(file: UploadFile = File(...)):
|
| 28 |
try:
|
| 29 |
+
image = Image.open(file.file).convert("RGB").resize((224,224)) # use training size
|
| 30 |
img_array = np.expand_dims(np.array(image) / 255.0, axis=0)
|
| 31 |
prediction = model.predict(img_array)
|
| 32 |
result = int(np.argmax(prediction))
|