Update app.py
Browse files
app.py
CHANGED
|
@@ -9,13 +9,12 @@ def predict_biome(uploaded_file):
|
|
| 9 |
if uploaded_file is None:
|
| 10 |
return "No file uploaded.", None, "No prediction"
|
| 11 |
|
| 12 |
-
model = tf.keras.models.load_model('biomes-
|
| 13 |
|
| 14 |
# Load the image from the file path
|
| 15 |
-
with Image.open(uploaded_file).convert('RGB') as img:
|
| 16 |
img = img.resize((150, 150))
|
| 17 |
img_array = np.array(img)
|
| 18 |
-
img_array = (img_array / 127.5) - 1.0 # Rescale the image as the model expects
|
| 19 |
|
| 20 |
prediction = model.predict(np.expand_dims(img_array, axis=0))
|
| 21 |
|
|
|
|
| 9 |
if uploaded_file is None:
|
| 10 |
return "No file uploaded.", None, "No prediction"
|
| 11 |
|
| 12 |
+
model = tf.keras.models.load_model('biomes-vgg-model.keras')
|
| 13 |
|
| 14 |
# Load the image from the file path
|
| 15 |
+
with Image.open(uploaded_file).convert('RGB') as img:
|
| 16 |
img = img.resize((150, 150))
|
| 17 |
img_array = np.array(img)
|
|
|
|
| 18 |
|
| 19 |
prediction = model.predict(np.expand_dims(img_array, axis=0))
|
| 20 |
|