Update app.py
Browse files
app.py
CHANGED
|
@@ -28,18 +28,22 @@ def predecir(rx_image):
|
|
| 28 |
other_class = CLASS_NAMES[other_index]
|
| 29 |
other_confidence = score[other_index] * 100
|
| 30 |
|
|
|
|
|
|
|
|
|
|
| 31 |
resultado_texto = f"""
|
| 32 |
<div style='
|
| 33 |
font-size:36px;
|
| 34 |
text-align:center;
|
| 35 |
padding:40px;
|
| 36 |
height:350px;
|
| 37 |
-
border: 3px solid
|
| 38 |
border-radius:25px;
|
| 39 |
background-color:#f0f0f0;
|
| 40 |
display:flex;
|
| 41 |
flex-direction:column;
|
| 42 |
justify-content:center;
|
|
|
|
| 43 |
'>
|
| 44 |
<div>Resultado: <b>{predicted_class.upper()}</b></div>
|
| 45 |
<div>Confianza: {confidence:.2f}%</div>
|
|
@@ -50,7 +54,7 @@ def predecir(rx_image):
|
|
| 50 |
return resultado_texto
|
| 51 |
|
| 52 |
with gr.Blocks(theme="default") as demo:
|
| 53 |
-
gr.Markdown("## Clasificador
|
| 54 |
|
| 55 |
with gr.Row():
|
| 56 |
with gr.Column():
|
|
@@ -60,7 +64,4 @@ with gr.Blocks(theme="default") as demo:
|
|
| 60 |
with gr.Column():
|
| 61 |
resultado = gr.HTML(label="Resultado")
|
| 62 |
|
| 63 |
-
boton_analizar.click(fn=predecir, inputs=rx_input
|
| 64 |
-
boton_limpiar.click(lambda: (None, None), inputs=[], outputs=[rx_input, resultado])
|
| 65 |
-
|
| 66 |
-
demo.launch()
|
|
|
|
| 28 |
other_class = CLASS_NAMES[other_index]
|
| 29 |
other_confidence = score[other_index] * 100
|
| 30 |
|
| 31 |
+
# Color según resultado
|
| 32 |
+
color_texto = "#4CAF50" if predicted_class == "valido" else "#FF0000"
|
| 33 |
+
|
| 34 |
resultado_texto = f"""
|
| 35 |
<div style='
|
| 36 |
font-size:36px;
|
| 37 |
text-align:center;
|
| 38 |
padding:40px;
|
| 39 |
height:350px;
|
| 40 |
+
border: 3px solid {color_texto};
|
| 41 |
border-radius:25px;
|
| 42 |
background-color:#f0f0f0;
|
| 43 |
display:flex;
|
| 44 |
flex-direction:column;
|
| 45 |
justify-content:center;
|
| 46 |
+
color:{color_texto};
|
| 47 |
'>
|
| 48 |
<div>Resultado: <b>{predicted_class.upper()}</b></div>
|
| 49 |
<div>Confianza: {confidence:.2f}%</div>
|
|
|
|
| 54 |
return resultado_texto
|
| 55 |
|
| 56 |
with gr.Blocks(theme="default") as demo:
|
| 57 |
+
gr.Markdown("## Clasificador de Radiografías Dentales 🦷")
|
| 58 |
|
| 59 |
with gr.Row():
|
| 60 |
with gr.Column():
|
|
|
|
| 64 |
with gr.Column():
|
| 65 |
resultado = gr.HTML(label="Resultado")
|
| 66 |
|
| 67 |
+
boton_analizar.click(fn=predecir, inputs=rx_input
|
|
|
|
|
|
|
|
|