sindhoorar commited on
Commit
68e771d
1 Parent(s): 068b6e3

initial commit

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