Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,23 +1,25 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
-
import tensorflow
|
|
|
|
| 4 |
from tensorflow.keras.models import load_model
|
| 5 |
from tensorflow.keras.preprocessing import image
|
| 6 |
|
|
|
|
|
|
|
| 7 |
MODEL_ISATRON_JEY = 'modelo_isatron_jeysshonl.h5'
|
| 8 |
|
| 9 |
cnn_model = load_model(MODEL_ISATRON_JEY)
|
| 10 |
|
| 11 |
def make_prediction(test_image):
|
| 12 |
-
test_image = test_image.name
|
| 13 |
test_image = image.load_img(test_image, target_size=(224, 224))
|
| 14 |
test_image = image.img_to_array(test_image) / 255.
|
| 15 |
test_image = np.expand_dims(test_image, axis=0)
|
| 16 |
result = cnn_model.predict(test_image)
|
| 17 |
return {"Normal": str(result[0][0]), "Neumonia": str(result[0][1])}
|
| 18 |
|
| 19 |
-
# Actualización
|
| 20 |
-
image_input = gr.Image(type="
|
| 21 |
|
| 22 |
description = ("El modelo IsaTron es una Red Neuronal Convolucional (CNN) diseñada como un método de apoyo medico "
|
| 23 |
"para el diagnóstico en imágenes radiológicas de neumonía pediátrica. Isatron arroja un porcentaje para "
|
|
@@ -50,3 +52,4 @@ interface = gr.Interface(
|
|
| 50 |
)
|
| 51 |
|
| 52 |
interface.launch(share=True)
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import numpy as np
|
| 3 |
+
import tensorflow as tf
|
| 4 |
+
import cv2
|
| 5 |
from tensorflow.keras.models import load_model
|
| 6 |
from tensorflow.keras.preprocessing import image
|
| 7 |
|
| 8 |
+
|
| 9 |
+
|
| 10 |
MODEL_ISATRON_JEY = 'modelo_isatron_jeysshonl.h5'
|
| 11 |
|
| 12 |
cnn_model = load_model(MODEL_ISATRON_JEY)
|
| 13 |
|
| 14 |
def make_prediction(test_image):
|
|
|
|
| 15 |
test_image = image.load_img(test_image, target_size=(224, 224))
|
| 16 |
test_image = image.img_to_array(test_image) / 255.
|
| 17 |
test_image = np.expand_dims(test_image, axis=0)
|
| 18 |
result = cnn_model.predict(test_image)
|
| 19 |
return {"Normal": str(result[0][0]), "Neumonia": str(result[0][1])}
|
| 20 |
|
| 21 |
+
# Actualización del tipo de entrada de imagen
|
| 22 |
+
image_input = gr.Image(type="filepath")
|
| 23 |
|
| 24 |
description = ("El modelo IsaTron es una Red Neuronal Convolucional (CNN) diseñada como un método de apoyo medico "
|
| 25 |
"para el diagnóstico en imágenes radiológicas de neumonía pediátrica. Isatron arroja un porcentaje para "
|
|
|
|
| 52 |
)
|
| 53 |
|
| 54 |
interface.launch(share=True)
|
| 55 |
+
|