SergioI1991 commited on
Commit
5188b18
verified
1 Parent(s): 5343e38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -11
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
- resultado_texto = (
32
- f"--- Resultado de la Clasificaci贸n ---\n"
33
- f"La imagen es: **{predicted_class.upper()}**\n"
34
- f"Confianza: {confidence:.2f}%\n"
35
- f"Probabilidad de ser {other_class}: {other_confidence:.2f}%\n"
36
- f"------------------------------------"
37
- )
 
 
 
 
 
 
 
 
38
 
39
  return resultado_texto
40
 
41
- # Interfaz est茅tica usando Blocks
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(type="numpy", label="Sube tu RX")
 
 
 
 
48
  boton = gr.Button("Analizar")
49
  with gr.Column():
50
- resultado = gr.Textbox(label="Resultado", interactive=False)
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