Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from keras.models import load_model
|
| 2 |
+
import cv2
|
| 3 |
+
import gradio as gr
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
intestine_model=load_model('/content/drive/MyDrive/Intestine_model.h5')
|
| 7 |
+
intestine_class_name={0:'Healthy',1:'Intestine have ulcer button'}
|
| 8 |
+
|
| 9 |
+
def predict_intestine(img):
|
| 10 |
+
img=cv2.resize(img,(224,224))
|
| 11 |
+
prediction=intestine_model.predict(img.reshape(1,224,224,3)).argmax()
|
| 12 |
+
return intestine_class_name[prediction]
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
interface=gr.Interface(fn=predict_intestine,inputs='image',outputs=[gr.components.Textbox(label='Result')])
|
| 16 |
+
|
| 17 |
+
interface.launch(debug=True)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|