Spaces:
Sleeping
Sleeping
Upload 8 files
Browse files- Final_Chicken_disease_model.h5 +3 -0
- app.py +37 -0
- auth_model.h5 +3 -0
- disease.jpg +0 -0
- hredirect2.webp +0 -0
- ncd.jpg +0 -0
- pcrsalmo.122.jpg +0 -0
- requirements.txt +3 -0
Final_Chicken_disease_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e6fbc0b00b8e4d86b50707fcb39a39f99eecccdb6f4732ea53cdfee793a052c4
|
| 3 |
+
size 234256896
|
app.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import keras
|
| 2 |
+
from keras.models import load_model
|
| 3 |
+
import gradio as gr
|
| 4 |
+
import cv2
|
| 5 |
+
|
| 6 |
+
my_model=load_model('Final_Chicken_disease_model.h5',compile=True)
|
| 7 |
+
auth_model=load_model('auth_model.h5',compile=True)
|
| 8 |
+
name_disease={0:'Coccidiosis',1:'Healthy',2:'New Castle Disease',3:'Salmonella'}
|
| 9 |
+
result={0:'Critical',1:'No issue',2:'Critical',3:'Critical'}
|
| 10 |
+
recommend={0:'Panadol',1:'You have no need Medicine',2:'Percetamol',3:'Ponston'}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def predict(image):
|
| 14 |
+
image_check=cv2.resize(image,(224,224))
|
| 15 |
+
indx=auth_model.predict(image_check.reshape(1,224,224,3)).argmax()
|
| 16 |
+
if indx==0:
|
| 17 |
+
image=cv2.resize(image,(224,224))
|
| 18 |
+
indx=my_model.predict(image.reshape(1,224,224,3)).argmax()
|
| 19 |
+
name=name_disease.get(indx)
|
| 20 |
+
status=result.get(indx)
|
| 21 |
+
recom=recommend.get(indx)
|
| 22 |
+
return name,status,recom
|
| 23 |
+
else:
|
| 24 |
+
name='Unkown Image'
|
| 25 |
+
status='N/A'
|
| 26 |
+
recom='N/A'
|
| 27 |
+
return name,status,recom
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
interface=gr.Interface(fn=predict,inputs=[gr.Image(label='upload Image')],outputs=[gr.components.Textbox(label="Disease Name"),gr.components.Textbox(label="result"),gr.components.Textbox(label='Medicine Recommend')],
|
| 31 |
+
examples=[['disease.jpg'],['ncd.jpg'],['hredirect2.webp']])
|
| 32 |
+
interface.launch(debug=True)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
auth_model.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:55ca5e07d8f4d45eab021364be749ced18402f85f5edb7425486ed76ea5c3093
|
| 3 |
+
size 234256896
|
disease.jpg
ADDED
|
hredirect2.webp
ADDED
|
ncd.jpg
ADDED
|
pcrsalmo.122.jpg
ADDED
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
tensorflow==2.12.0
|
| 2 |
+
keras
|
| 3 |
+
opencv-python
|