Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,21 +4,11 @@ import cv2
|
|
4 |
from flask import Flask, request, jsonify, render_template
|
5 |
from tensorflow.keras.models import load_model # type: ignore
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
# Path to the model file
|
10 |
-
model_path = 'pneumonia_model.keras'
|
11 |
-
|
12 |
-
# Check if the model file exists
|
13 |
-
if not os.path.exists(model_path):
|
14 |
-
raise FileNotFoundError(f"The model file {model_path} does not exist.")
|
15 |
|
16 |
# Load the saved model
|
17 |
-
|
18 |
-
model = load_model(model_path)
|
19 |
-
except ValueError as e:
|
20 |
-
print(f"Error loading the model: {e}")
|
21 |
-
raise
|
22 |
|
23 |
def preprocess_image(image):
|
24 |
"""Preprocess the image for prediction."""
|
|
|
4 |
from flask import Flask, request, jsonify, render_template
|
5 |
from tensorflow.keras.models import load_model # type: ignore
|
6 |
|
7 |
+
# Specify the template folder manually
|
8 |
+
app = Flask(__name__, template_folder='.')
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
# Load the saved model
|
11 |
+
model = load_model('pneumonia_model.keras')
|
|
|
|
|
|
|
|
|
12 |
|
13 |
def preprocess_image(image):
|
14 |
"""Preprocess the image for prediction."""
|