Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,8 +6,8 @@ from keras.models import load_model
|
|
6 |
import tensorflow as tf
|
7 |
from tensorflow import keras
|
8 |
|
9 |
-
# Cargar el modelo entrenado
|
10 |
-
model1 = load_model('./
|
11 |
|
12 |
# Función para encontrar la última capa convolucional
|
13 |
def find_last_conv_layer(model):
|
@@ -100,14 +100,15 @@ def image_classifier1(img):
|
|
100 |
prediction_percentage = {'PNEUMONIA': float(prediction), 'NORMAL': float(1 - prediction)}
|
101 |
return overlayed_img, prediction_percentage
|
102 |
|
103 |
-
# Definir CSS personalizado
|
104 |
custom_css = """
|
105 |
body {
|
106 |
-
background-color: #
|
|
|
107 |
}
|
108 |
|
109 |
h1 {
|
110 |
-
color: #
|
111 |
text-align: center;
|
112 |
}
|
113 |
|
@@ -116,24 +117,25 @@ h1 {
|
|
116 |
max-width: 800px;
|
117 |
margin: auto;
|
118 |
padding: 20px;
|
119 |
-
background-color: #
|
120 |
border-radius: 10px;
|
|
|
121 |
}
|
122 |
|
123 |
.footer {
|
124 |
text-align: center;
|
125 |
margin-top: 20px;
|
126 |
-
color: #
|
127 |
font-size: 14px;
|
128 |
}
|
129 |
|
130 |
label {
|
131 |
font-weight: bold;
|
132 |
-
color: #
|
133 |
}
|
134 |
|
135 |
button {
|
136 |
-
background-color: #
|
137 |
color: white;
|
138 |
border: none;
|
139 |
padding: 10px 20px;
|
@@ -141,7 +143,7 @@ button {
|
|
141 |
}
|
142 |
|
143 |
button:hover {
|
144 |
-
background-color: #
|
145 |
}
|
146 |
"""
|
147 |
|
@@ -153,7 +155,7 @@ demo_model1 = gr.Interface(
|
|
153 |
gr.Image(type="numpy", label="Imagen con Mapa de Calor"),
|
154 |
gr.Label(num_top_classes=2, label="Resultados de Predicción")
|
155 |
],
|
156 |
-
title="IsaTron V2
|
157 |
description="Esta aplicación detecta neumonía a partir de imágenes de radiografías de tórax.",
|
158 |
article="<div class='footer'>Jeysshon 2024</div>",
|
159 |
css=custom_css
|
|
|
6 |
import tensorflow as tf
|
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 |
+
# Definir CSS personalizado con fondo oscuro
|
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 |
|
|
|
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;
|
|
|
143 |
}
|
144 |
|
145 |
button:hover {
|
146 |
+
background-color: #cc5200;
|
147 |
}
|
148 |
"""
|
149 |
|
|
|
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="<div class='footer'>Jeysshon 2024</div>",
|
161 |
css=custom_css
|