Elena
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -3,11 +3,9 @@ from tensorflow.keras.models import load_model
|
|
3 |
import numpy as np
|
4 |
from PIL import Image
|
5 |
|
6 |
-
# Load the trained model
|
7 |
model = load_model('xray_image_classifier_model.keras')
|
8 |
|
9 |
def predict(image):
|
10 |
-
# Preprocess the input image
|
11 |
img = image.resize((150, 150))
|
12 |
img_array = np.array(img) / 255.0
|
13 |
img_array = np.expand_dims(img_array, axis=0)
|
@@ -18,7 +16,7 @@ def predict(image):
|
|
18 |
|
19 |
return predicted_class
|
20 |
|
21 |
-
|
22 |
css = """
|
23 |
.gradio-container {
|
24 |
background-color: #f5f5f5;
|
@@ -57,7 +55,7 @@ css = """
|
|
57 |
}
|
58 |
"""
|
59 |
|
60 |
-
# Gradio interface
|
61 |
with gr.Blocks(css=css) as interface:
|
62 |
gr.Markdown("<h1>Chest X-ray Pneumonia Classifier</h1>")
|
63 |
gr.Markdown("<p>Upload an X-ray image to classify it as 'Pneumonia' or 'Normal'.</p>")
|
|
|
3 |
import numpy as np
|
4 |
from PIL import Image
|
5 |
|
|
|
6 |
model = load_model('xray_image_classifier_model.keras')
|
7 |
|
8 |
def predict(image):
|
|
|
9 |
img = image.resize((150, 150))
|
10 |
img_array = np.array(img) / 255.0
|
11 |
img_array = np.expand_dims(img_array, axis=0)
|
|
|
16 |
|
17 |
return predicted_class
|
18 |
|
19 |
+
|
20 |
css = """
|
21 |
.gradio-container {
|
22 |
background-color: #f5f5f5;
|
|
|
55 |
}
|
56 |
"""
|
57 |
|
58 |
+
# Gradio interface set up
|
59 |
with gr.Blocks(css=css) as interface:
|
60 |
gr.Markdown("<h1>Chest X-ray Pneumonia Classifier</h1>")
|
61 |
gr.Markdown("<p>Upload an X-ray image to classify it as 'Pneumonia' or 'Normal'.</p>")
|