sindhoorar commited on
Commit
834f53a
1 Parent(s): 68bcdf9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,9 +1,10 @@
1
  import gradio as gr
2
  from tensorflow.keras.models import load_model
3
  from tensorflow.keras.preprocessing import image
4
- import numpy as np
5
  from keras.applications.imagenet_utils import preprocess_input
 
6
 
 
7
  model = load_model('dementia.h5')
8
 
9
  def classify_image(inp):
@@ -12,13 +13,14 @@ def classify_image(inp):
12
  prediction = model.predict(inp).flatten()
13
  return {"Dementia not Detected": float(prediction[0]), "Dementia Detected": float(prediction[1])}
14
 
15
- image = gr.Image(shape=(224, 224)) # Modify this line
 
16
 
17
  interface = gr.Interface(
18
  fn=classify_image,
19
- inputs=image,
20
  outputs="label",
21
  title="DementAI",
22
  )
23
 
24
- interface.launch()
 
1
  import gradio as gr
2
  from tensorflow.keras.models import load_model
3
  from tensorflow.keras.preprocessing import image
 
4
  from keras.applications.imagenet_utils import preprocess_input
5
+ import numpy as np
6
 
7
+ # Load the model
8
  model = load_model('dementia.h5')
9
 
10
  def classify_image(inp):
 
13
  prediction = model.predict(inp).flatten()
14
  return {"Dementia not Detected": float(prediction[0]), "Dementia Detected": float(prediction[1])}
15
 
16
+ # Use 'image_mode' to specify the shape
17
+ image_input = gr.Image(image_mode="RGB", source="upload", shape=(224, 224))
18
 
19
  interface = gr.Interface(
20
  fn=classify_image,
21
+ inputs=image_input,
22
  outputs="label",
23
  title="DementAI",
24
  )
25
 
26
+ interface.launch()