update app
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
|
|
5 |
from gradio.themes.base import Base
|
6 |
import cv2
|
7 |
from tensorflow.keras.models import load_model
|
8 |
-
model_path = "
|
9 |
model = load_model(model_path)
|
10 |
def load_and_prepare_image(image_path):
|
11 |
# Load the image
|
@@ -20,7 +20,7 @@ def load_and_prepare_image(image_path):
|
|
20 |
|
21 |
def predict(image_path):
|
22 |
if image_path is None:
|
23 |
-
return "Please upload an image.", "
|
24 |
|
25 |
# Prepare the image
|
26 |
img = load_and_prepare_image(image_path)
|
@@ -35,15 +35,15 @@ def predict(image_path):
|
|
35 |
else 'The X-ray indicates that the patient\'s lungs are normal.'
|
36 |
)
|
37 |
|
38 |
-
return label, "
|
39 |
|
40 |
# Fixed image URL
|
41 |
-
fixed_image_url = "
|
42 |
|
43 |
# Example images and their descriptions
|
44 |
examples = [
|
45 |
-
["
|
46 |
-
["
|
47 |
]
|
48 |
# Create the Gradio interface
|
49 |
iface = gr.Interface(
|
|
|
5 |
from gradio.themes.base import Base
|
6 |
import cv2
|
7 |
from tensorflow.keras.models import load_model
|
8 |
+
model_path = "xray_model.h5"
|
9 |
model = load_model(model_path)
|
10 |
def load_and_prepare_image(image_path):
|
11 |
# Load the image
|
|
|
20 |
|
21 |
def predict(image_path):
|
22 |
if image_path is None:
|
23 |
+
return "Please upload an image.", "How-AI-is-Used-in-Healthcare.png"
|
24 |
|
25 |
# Prepare the image
|
26 |
img = load_and_prepare_image(image_path)
|
|
|
35 |
else 'The X-ray indicates that the patient\'s lungs are normal.'
|
36 |
)
|
37 |
|
38 |
+
return label, "How-AI-is-Used-in-Healthcare.png"
|
39 |
|
40 |
# Fixed image URL
|
41 |
+
fixed_image_url = "How-AI-is-Used-in-Healthcare.png"
|
42 |
|
43 |
# Example images and their descriptions
|
44 |
examples = [
|
45 |
+
["normal.jpeg", "Normal X-ray image."],
|
46 |
+
["pne.jpeg", "X-ray image indicating pneumonia."]
|
47 |
]
|
48 |
# Create the Gradio interface
|
49 |
iface = gr.Interface(
|