crossdevlogix commited on
Commit
912f35b
·
verified ·
1 Parent(s): fbe29c4

Upload 14 files

Browse files
Files changed (14) hide show
  1. Chicken_Heart_model.h5 +3 -0
  2. Image1.PNG +0 -0
  3. Image10.PNG +0 -0
  4. Image11.PNG +0 -0
  5. Image2.PNG +0 -0
  6. Image3.PNG +0 -0
  7. Image4.PNG +0 -0
  8. Image5.PNG +0 -0
  9. Image6.PNG +0 -0
  10. Image7.PNG +0 -0
  11. Image8.PNG +0 -0
  12. Image9.PNG +0 -0
  13. app.py +51 -0
  14. requirements.txt +3 -0
Chicken_Heart_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d783c67e3831d9f027248cdabec0463807c16871692e4cd6100a6e0d1341b012
3
+ size 220570576
Image1.PNG ADDED
Image10.PNG ADDED
Image11.PNG ADDED
Image2.PNG ADDED
Image3.PNG ADDED
Image4.PNG ADDED
Image5.PNG ADDED
Image6.PNG ADDED
Image7.PNG ADDED
Image8.PNG ADDED
Image9.PNG ADDED
app.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from keras.models import load_model
2
+ import cv2
3
+ from tensorflow.keras.preprocessing.image import ImageDataGenerator
4
+ import gradio as gr
5
+ import numpy as np
6
+
7
+ heart_model=load_model('Chicken_Heart_model.h5',compile=True)
8
+ class_name={0:'Dilation(eccentric)',1:'Hepatoma',2:'Hypertrophy(concentric)',3:'Hypertrophy(physiological)',4:'Infraction Damage',5:'Normal'}
9
+
10
+ def Heart_Disease_prediction(img):
11
+ img = img.reshape((1, img.shape[0], img.shape[1], img.shape[2]))
12
+
13
+ # Create the data generator with desired properties
14
+ datagen = ImageDataGenerator(
15
+ rotation_range=30,
16
+ width_shift_range=0.1,
17
+ height_shift_range=0.1,
18
+ shear_range=0.1,
19
+ zoom_range=0.1,
20
+ horizontal_flip=True,
21
+ fill_mode="nearest",
22
+ )
23
+ # Generate a batch of augmented images (contains only the single image)
24
+ augmented_images = datagen.flow(img, batch_size=1)
25
+ # Get the first (and only) augmented image from the batch
26
+ augmented_img = next(augmented_images)[0]
27
+ img=cv2.resize(augmented_img.astype(np.uint8),(128,128))
28
+ class_no=heart_model.predict(img.reshape(1,128,128,3)).argmax()
29
+ name=class_name.get(class_no)
30
+ return name
31
+
32
+
33
+ interface=gr.Interface(fn=Heart_Disease_prediction,inputs='image',outputs=[gr.components.Textbox(label='Disease Name')],
34
+ examples=[['Image1.PNG'],['Image2.PNG'],['Image3.PNG'],['Image4.PNG'],
35
+ ['Image5.PNG'],['Image6.PNG'],['Image7.PNG'],['Image8.PNG'],
36
+ ['Image9.PNG'],['Image10.PNG'],['Image11.PNG']])
37
+
38
+ interface.launch(debug=True)
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tensorflow==2.12.0
2
+ keras
3
+ opencv-python