| import gradio as gr | |
| import cv2 | |
| from keras.models import load_model | |
| my_model=load_model('Liver_model.h5',compile=True) | |
| class_num={0:'Healthy',1:'Un-Healthy'} | |
| def Predict(Image): | |
| Image=cv2.resize(Image,(224,224)) | |
| class_no=my_model.predict(Image.reshape(1,224,224,3)).argmax() | |
| class_name=class_num.get(class_no) | |
| return class_name | |
| interface=gr.Interface(fn=Predict,inputs='image',outputs=[gr.components.Textbox(label="Class Name")], | |
| title="This Space predict the liver of Chicken is healthy or un-healthy", | |
| examples=[['Test1.jpg'],['Test2.jpeg'],['Test3.jpeg']]) | |
| interface.launch(debug=True) | |