asmaa1 commited on
Commit
690683d
·
verified ·
1 Parent(s): 3b50f5c

update app

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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 = "/content/drive/MyDrive/Pneumonia Classification/model/xray_model.h5"
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.", "/content/How-AI-is-Used-in-Healthcare.png"
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, "/content/drive/MyDrive/Pneumonia Classification/images/How-AI-is-Used-in-Healthcare.png"
39
 
40
  # Fixed image URL
41
- fixed_image_url = "/content/drive/MyDrive/Pneumonia Classification/images/How-AI-is-Used-in-Healthcare.png"
42
 
43
  # Example images and their descriptions
44
  examples = [
45
- ["/content/drive/MyDrive/Pneumonia Classification/images/normal.jpeg", "Normal X-ray image."],
46
- ["/content/drive/MyDrive/Pneumonia Classification/images/pne.jpeg", "X-ray image indicating pneumonia."]
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(