Update app.py
Browse files
app.py
CHANGED
|
@@ -6,7 +6,7 @@ IMG_SIZE = (224, 224)
|
|
| 6 |
MODEL_PATH = "dental_classifier_model.keras"
|
| 7 |
CLASS_NAMES = ['no_valido', 'valido']
|
| 8 |
|
| 9 |
-
# Cargar modelo
|
| 10 |
model = tf.keras.models.load_model(MODEL_PATH)
|
| 11 |
|
| 12 |
def preprocess_image(img):
|
|
@@ -28,19 +28,23 @@ def predecir(rx_image):
|
|
| 28 |
other_class = CLASS_NAMES[other_index]
|
| 29 |
other_confidence = score[other_index] * 100
|
| 30 |
|
| 31 |
-
#
|
| 32 |
resultado_texto = f"""
|
| 33 |
<div style='
|
| 34 |
-
font-size:
|
| 35 |
text-align:center;
|
| 36 |
-
padding:
|
|
|
|
| 37 |
border: 3px solid #4CAF50;
|
| 38 |
-
border-radius:
|
| 39 |
background-color:#f0f0f0;
|
|
|
|
|
|
|
|
|
|
| 40 |
'>
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
</div>
|
| 45 |
"""
|
| 46 |
|
|
@@ -55,7 +59,7 @@ with gr.Blocks(theme="default") as demo:
|
|
| 55 |
rx_input = gr.Image(
|
| 56 |
type="numpy",
|
| 57 |
label="Sube tu RX",
|
| 58 |
-
source="upload"
|
| 59 |
)
|
| 60 |
boton = gr.Button("Analizar")
|
| 61 |
with gr.Column():
|
|
|
|
| 6 |
MODEL_PATH = "dental_classifier_model.keras"
|
| 7 |
CLASS_NAMES = ['no_valido', 'valido']
|
| 8 |
|
| 9 |
+
# Cargar modelo
|
| 10 |
model = tf.keras.models.load_model(MODEL_PATH)
|
| 11 |
|
| 12 |
def preprocess_image(img):
|
|
|
|
| 28 |
other_class = CLASS_NAMES[other_index]
|
| 29 |
other_confidence = score[other_index] * 100
|
| 30 |
|
| 31 |
+
# Caja grande sin scroll
|
| 32 |
resultado_texto = f"""
|
| 33 |
<div style='
|
| 34 |
+
font-size:36px;
|
| 35 |
text-align:center;
|
| 36 |
+
padding:40px;
|
| 37 |
+
height:350px;
|
| 38 |
border: 3px solid #4CAF50;
|
| 39 |
+
border-radius:25px;
|
| 40 |
background-color:#f0f0f0;
|
| 41 |
+
display:flex;
|
| 42 |
+
flex-direction:column;
|
| 43 |
+
justify-content:center;
|
| 44 |
'>
|
| 45 |
+
<div>Resultado: <b>{predicted_class.upper()}</b></div>
|
| 46 |
+
<div>Confianza: {confidence:.2f}%</div>
|
| 47 |
+
<div>Probabilidad {other_class}: {other_confidence:.2f}%</div>
|
| 48 |
</div>
|
| 49 |
"""
|
| 50 |
|
|
|
|
| 59 |
rx_input = gr.Image(
|
| 60 |
type="numpy",
|
| 61 |
label="Sube tu RX",
|
| 62 |
+
source="upload"
|
| 63 |
)
|
| 64 |
boton = gr.Button("Analizar")
|
| 65 |
with gr.Column():
|