jeysshon commited on
Commit
7b23309
·
verified ·
1 Parent(s): 028711c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -30
app.py CHANGED
@@ -1,8 +1,6 @@
1
  import gradio as gr
2
  import numpy as np
3
  import tensorflow
4
- import cv2
5
- from keras.models import load_model
6
  from tensorflow.keras.models import load_model
7
  from tensorflow.keras.preprocessing import image
8
 
@@ -17,36 +15,38 @@ def make_prediction(test_image):
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
-
22
- image_input = gr.inputs.Image(type="file")
23
-
24
- description = " El modelo IsaTron es una Red Neuronal Convolucional (CNN) diseñada como un método de apoyo medico para el diagnóstico en imágenes radiológicas de neumonía pediátrica. Isatron arroja un porcentaje para lograr interpretar la radiografia torácica. En la parte inferior encontrará unas imágenes que pueden ser usadas para ejemplificar el funcionamiento del modelo. https://repositorio.unbosque.edu.co/handle/20.500.12495/9514"
25
 
 
 
 
 
 
 
 
 
26
 
27
-
28
  enable_queue = True
29
  examples = [
30
- ['1normal.jpeg'],
31
- ['image1_pneumonia_virus.jpeg'],
32
- ['image1_pneumonia_bacteria.jpeg'],
33
- ['image2_normal.jpeg'],
34
- ['image2_pneumonia_bacteria.jpeg'],
35
- ['image3_normal.jpeg'],
36
- ['image4_normal.jpeg'],
37
- ]
38
-
39
- article= "<p style='text-align: center'><span style='font-size: 15pt;'>IsaTron . Jeysshon Bustos . 2022. </span></p>"
40
-
41
-
42
- interface=gr.Interface(fn=make_prediction,
43
- inputs=image_input,
44
- outputs='label',
45
- title="Modelo (CNN) IsaTron ",
46
- ##interpretation = "default",
47
- description=description,
48
- theme="default",
49
- article=article,
50
- examples=examples,
51
- enable_queue=enable_queue )
52
  interface.launch(share=True)
 
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
 
 
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 de la definición del componente de entrada de imagen
20
+ image_input = gr.Image(type="file")
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 "
24
+ "lograr interpretar la radiografía torácica. En la parte inferior encontrará unas imágenes que pueden "
25
+ "ser usadas para ejemplificar el funcionamiento del modelo. "
26
+ "https://repositorio.unbosque.edu.co/handle/20.500.12495/9514")
27
 
 
28
  enable_queue = True
29
  examples = [
30
+ ['1normal.jpeg'],
31
+ ['image1_pneumonia_virus.jpeg'],
32
+ ['image1_pneumonia_bacteria.jpeg'],
33
+ ['image2_normal.jpeg'],
34
+ ['image2_pneumonia_bacteria.jpeg'],
35
+ ['image3_normal.jpeg'],
36
+ ['image4_normal.jpeg'],
37
+ ]
38
+
39
+ article = "<p style='text-align: center'><span style='font-size: 15pt;'>IsaTron . Jeysshon Bustos . 2022. </span></p>"
40
+
41
+ interface = gr.Interface(
42
+ fn=make_prediction,
43
+ inputs=image_input,
44
+ outputs='label',
45
+ title="Modelo (CNN) IsaTron",
46
+ description=description,
47
+ article=article,
48
+ examples=examples,
49
+ enable_queue=enable_queue
50
+ )
51
+
52
  interface.launch(share=True)