crossdevlogix commited on
Commit
9eec077
·
verified ·
1 Parent(s): fdd80df

Upload 7 files

Browse files
Files changed (7) hide show
  1. Chicken_Gizzard_Updated_model.h5 +3 -0
  2. Class A.PNG +0 -0
  3. Class B.PNG +0 -0
  4. Class C.PNG +0 -0
  5. Class D.PNG +0 -0
  6. app.py +57 -0
  7. requirements.txt +3 -0
Chicken_Gizzard_Updated_model.h5 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7eca91c45f1921cba0ffa9bc08e06d88cc463d107a680db78ccc3747f4a487f5
3
+ size 213997120
Class A.PNG ADDED
Class B.PNG ADDED
Class C.PNG ADDED
Class D.PNG ADDED
app.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ from keras.models import load_model
3
+ import gradio as gr
4
+ import numpy as np
5
+ from tensorflow.keras.preprocessing.image import ImageDataGenerator
6
+
7
+ model = load_model('Chicken_Gizzard_Updated_model.h5',compile=True)
8
+ class_names={0:'Normal Appearance',
9
+ 1:'The proventriculusof infected chickens showing several ecchymotic hemorrhages on the tip of the proventricular glandsat 3 dpi',
10
+ 2:'edema with increased number of solitary and coalesced ecchymotic hemorrhages on theproventricular glands at 4 dpi',
11
+ 3:'and numerous hemorrhagic spots coalesced to form brush paintappearance on the entire mucosa at 5 dpi'}
12
+
13
+ def Predict_Gizzard(img):
14
+ img = img.reshape((1, img.shape[0], img.shape[1], img.shape[2]))
15
+
16
+ # Create the data generator with desired properties
17
+ datagen = ImageDataGenerator(
18
+ rotation_range=30,
19
+ width_shift_range=0.1,
20
+ height_shift_range=0.1,
21
+ shear_range=0.1,
22
+ zoom_range=0.1,
23
+ horizontal_flip=True,
24
+ fill_mode="nearest",
25
+ )
26
+ # Generate a batch of augmented images (contains only the single image)
27
+ augmented_images = datagen.flow(img, batch_size=1)
28
+ # Get the first (and only) augmented image from the batch
29
+ augmented_img = next(augmented_images)[0]
30
+ img=cv2.resize(augmented_img.astype(np.uint8),(224,224))
31
+ class_no=model.predict(img.reshape(1,224,224,3)).argmax()
32
+ name=class_names.get(class_no)
33
+ return name
34
+
35
+
36
+ interface=gr.Interface(fn=Predict_Gizzard,inputs='image',outputs=[gr.components.Textbox(label='Your Result')],
37
+ examples=[['Class A.PNG'],['Class B.PNG'],['Class C.PNG'],['Class D.PNG']])
38
+
39
+ interface.launch(debug=True)
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ tensorflow==2.12.0
2
+ keras
3
+ opencv-python