Update app.py
Browse files
app.py
CHANGED
|
@@ -28,26 +28,38 @@ def predecir(rx_image):
|
|
| 28 |
other_class = CLASS_NAMES[other_index]
|
| 29 |
other_confidence = score[other_index] * 100
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
return resultado_texto
|
| 40 |
|
| 41 |
-
# Interfaz
|
| 42 |
with gr.Blocks(theme="default") as demo:
|
| 43 |
-
gr.Markdown("## Clasificador de Radiograf铆as Dentales 馃Ψ")
|
| 44 |
|
| 45 |
with gr.Row():
|
| 46 |
with gr.Column():
|
| 47 |
-
rx_input = gr.Image(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
boton = gr.Button("Analizar")
|
| 49 |
with gr.Column():
|
| 50 |
-
resultado = gr.
|
| 51 |
|
| 52 |
boton.click(fn=predecir, inputs=rx_input, outputs=resultado)
|
| 53 |
|
|
|
|
| 28 |
other_class = CLASS_NAMES[other_index]
|
| 29 |
other_confidence = score[other_index] * 100
|
| 30 |
|
| 31 |
+
# Resultado grande con estilo
|
| 32 |
+
resultado_texto = f"""
|
| 33 |
+
<div style='
|
| 34 |
+
font-size:40px;
|
| 35 |
+
text-align:center;
|
| 36 |
+
padding:30px;
|
| 37 |
+
border: 3px solid #4CAF50;
|
| 38 |
+
border-radius:20px;
|
| 39 |
+
background-color:#f0f0f0;
|
| 40 |
+
'>
|
| 41 |
+
Resultado: <b>{predicted_class.upper()}</b><br>
|
| 42 |
+
Confianza: {confidence:.2f}%<br>
|
| 43 |
+
Probabilidad {other_class}: {other_confidence:.2f}%
|
| 44 |
+
</div>
|
| 45 |
+
"""
|
| 46 |
|
| 47 |
return resultado_texto
|
| 48 |
|
| 49 |
+
# Interfaz Gradio
|
| 50 |
with gr.Blocks(theme="default") as demo:
|
| 51 |
+
gr.Markdown("## Clasificador de Radiograf铆as Dentales 馃Ψ", elem_id="titulo")
|
| 52 |
|
| 53 |
with gr.Row():
|
| 54 |
with gr.Column():
|
| 55 |
+
rx_input = gr.Image(
|
| 56 |
+
type="numpy",
|
| 57 |
+
label="Sube tu RX",
|
| 58 |
+
source="upload" # Solo upload, sin webcam ni portapapeles
|
| 59 |
+
)
|
| 60 |
boton = gr.Button("Analizar")
|
| 61 |
with gr.Column():
|
| 62 |
+
resultado = gr.HTML(label="Resultado")
|
| 63 |
|
| 64 |
boton.click(fn=predecir, inputs=rx_input, outputs=resultado)
|
| 65 |
|