Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,7 +7,7 @@ import tensorflow as tf
|
|
7 |
from tensorflow import keras
|
8 |
|
9 |
# Cargar el nuevo modelo entrenado
|
10 |
-
model1 = load_model('./
|
11 |
|
12 |
# Función para encontrar la última capa convolucional
|
13 |
def find_last_conv_layer(model):
|
@@ -100,54 +100,7 @@ def image_classifier1(img):
|
|
100 |
prediction_percentage = {'PNEUMONIA': float(prediction), 'NORMAL': float(1 - prediction)}
|
101 |
return overlayed_img, prediction_percentage
|
102 |
|
103 |
-
#
|
104 |
-
custom_css = """
|
105 |
-
body {
|
106 |
-
background-color: #1a1a1a;
|
107 |
-
color: #e6e6e6;
|
108 |
-
}
|
109 |
-
|
110 |
-
h1 {
|
111 |
-
color: #ffcc00;
|
112 |
-
text-align: center;
|
113 |
-
}
|
114 |
-
|
115 |
-
.gradio-container {
|
116 |
-
font-family: 'Arial', sans-serif;
|
117 |
-
max-width: 800px;
|
118 |
-
margin: auto;
|
119 |
-
padding: 20px;
|
120 |
-
background-color: #333333;
|
121 |
-
border-radius: 10px;
|
122 |
-
border: 1px solid #666666;
|
123 |
-
}
|
124 |
-
|
125 |
-
.footer {
|
126 |
-
text-align: center;
|
127 |
-
margin-top: 20px;
|
128 |
-
color: #e6e6e6;
|
129 |
-
font-size: 14px;
|
130 |
-
}
|
131 |
-
|
132 |
-
label {
|
133 |
-
font-weight: bold;
|
134 |
-
color: #e6e6e6;
|
135 |
-
}
|
136 |
-
|
137 |
-
button {
|
138 |
-
background-color: #ff6600;
|
139 |
-
color: white;
|
140 |
-
border: none;
|
141 |
-
padding: 10px 20px;
|
142 |
-
cursor: pointer;
|
143 |
-
}
|
144 |
-
|
145 |
-
button:hover {
|
146 |
-
background-color: #cc5200;
|
147 |
-
}
|
148 |
-
"""
|
149 |
-
|
150 |
-
# Crear interfaz Gradio con CSS personalizado y pie de página
|
151 |
demo_model1 = gr.Interface(
|
152 |
fn=image_classifier1,
|
153 |
inputs=gr.Image(type="pil", label="Sube una imagen de radiografía"),
|
@@ -155,10 +108,9 @@ demo_model1 = gr.Interface(
|
|
155 |
gr.Image(type="numpy", label="Imagen con Mapa de Calor"),
|
156 |
gr.Label(num_top_classes=2, label="Resultados de Predicción")
|
157 |
],
|
158 |
-
title="IsaTron V2 ",
|
159 |
description="Esta aplicación detecta neumonía a partir de imágenes de radiografías de tórax.",
|
160 |
-
article="
|
161 |
-
css=custom_css
|
162 |
)
|
163 |
|
164 |
# Ejecutar la interfaz
|
|
|
7 |
from tensorflow import keras
|
8 |
|
9 |
# Cargar el nuevo modelo entrenado
|
10 |
+
model1 = load_model('./modelo_isatron_jeysshonl.h5')
|
11 |
|
12 |
# Función para encontrar la última capa convolucional
|
13 |
def find_last_conv_layer(model):
|
|
|
100 |
prediction_percentage = {'PNEUMONIA': float(prediction), 'NORMAL': float(1 - prediction)}
|
101 |
return overlayed_img, prediction_percentage
|
102 |
|
103 |
+
# Crear interfaz Gradio con estilo predeterminado y pie de página
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
demo_model1 = gr.Interface(
|
105 |
fn=image_classifier1,
|
106 |
inputs=gr.Image(type="pil", label="Sube una imagen de radiografía"),
|
|
|
108 |
gr.Image(type="numpy", label="Imagen con Mapa de Calor"),
|
109 |
gr.Label(num_top_classes=2, label="Resultados de Predicción")
|
110 |
],
|
111 |
+
title="IsaTron V2 con Mapa de Calor",
|
112 |
description="Esta aplicación detecta neumonía a partir de imágenes de radiografías de tórax.",
|
113 |
+
article="Jeysshon 2024"
|
|
|
114 |
)
|
115 |
|
116 |
# Ejecutar la interfaz
|