tmafantiri commited on
Commit
89d9c97
·
verified ·
1 Parent(s): 4a2a11e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import numpy as np
3
  from PIL import Image
4
  from keras.models import load_model
 
5
 
6
  # Load the pre-trained model
7
  model = load_model('brain_tumor_model.h5')
@@ -28,6 +29,10 @@ def predict_image(image):
28
  else:
29
  return f'Tumor detected. Confidence: {confidence:.2f}%'
30
 
 
 
 
 
31
  # Create the Hugging Face Space
32
  iface = gr.Interface(
33
  fn=predict_image,
@@ -35,12 +40,7 @@ iface = gr.Interface(
35
  outputs=gr.Textbox(),
36
  title="Brain Tumor Detection AI App",
37
  description="Upload an image to detect brain tumors.",
38
- examples=[
39
- ["images/no/1_no.jpeg"],
40
- ["images/yes/Y1.jpg"],
41
- ["images/no/15_no.jpg"],
42
- ["images/yes/Y104.jpg"]
43
- ]
44
  )
45
 
46
  iface.launch(share=True)
 
2
  import numpy as np
3
  from PIL import Image
4
  from keras.models import load_model
5
+ import json
6
 
7
  # Load the pre-trained model
8
  model = load_model('brain_tumor_model.h5')
 
29
  else:
30
  return f'Tumor detected. Confidence: {confidence:.2f}%'
31
 
32
+ # Load examples from the JSON file
33
+ with open('examples.json') as f:
34
+ examples = json.load(f)
35
+
36
  # Create the Hugging Face Space
37
  iface = gr.Interface(
38
  fn=predict_image,
 
40
  outputs=gr.Textbox(),
41
  title="Brain Tumor Detection AI App",
42
  description="Upload an image to detect brain tumors.",
43
+ examples=examples
 
 
 
 
 
44
  )
45
 
46
  iface.launch(share=True)