Ariel013 commited on
Commit
a46ba42
verified
1 Parent(s): 02ee94f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -23
app.py CHANGED
@@ -45,7 +45,11 @@ examples = [
45
  ]
46
 
47
  # Construir interfaz
48
- with gr.Blocks(theme=gr.themes.Soft(), css=".example-image {margin: auto; display: block}") as app:
 
 
 
 
49
  gr.Markdown("# 馃摲 Clasificador CIFAR-10")
50
 
51
  with gr.Row():
@@ -67,31 +71,31 @@ with gr.Blocks(theme=gr.themes.Soft(), css=".example-image {margin: auto; displa
67
  show_label=True
68
  )
69
 
70
- # Secci贸n de ejemplos en 2 filas de 5 columnas
71
  gr.Markdown("## Ejemplos de categor铆as")
72
- with gr.Column():
73
  # Primera fila
74
- with gr.Row():
75
- for i in range(5):
76
- with gr.Column(min_width=150):
77
- gr.Image(
78
- examples[i][0],
79
- label=cifar10_labels[i].capitalize(),
80
- height=120,
81
- width=120,
82
- elem_classes=["example-image"]
83
- )
84
  # Segunda fila
85
- with gr.Row():
86
- for i in range(5, 10):
87
- with gr.Column(min_width=150):
88
- gr.Image(
89
- examples[i][0],
90
- label=cifar10_labels[i].capitalize(),
91
- height=120,
92
- width=120,
93
- elem_classes=["example-image"]
94
- )
95
 
96
  # Conectar eventos
97
  submit_btn.click(
 
45
  ]
46
 
47
  # Construir interfaz
48
+ with gr.Blocks(theme=gr.themes.Soft(), css="""
49
+ .examples-grid {display: flex !important; flex-direction: column; gap: 1rem}
50
+ .examples-row {display: flex !important; gap: 1rem; justify-content: center}
51
+ """) as app:
52
+
53
  gr.Markdown("# 馃摲 Clasificador CIFAR-10")
54
 
55
  with gr.Row():
 
71
  show_label=True
72
  )
73
 
74
+ # Secci贸n de ejemplos con interacci贸n
75
  gr.Markdown("## Ejemplos de categor铆as")
76
+ with gr.Column(elem_classes=["examples-grid"]):
77
  # Primera fila
78
+ with gr.Row(elem_classes=["examples-row"]):
79
+ for example, label in zip(examples[:5], cifar10_labels[:5]):
80
+ gr.Examples(
81
+ examples=example,
82
+ inputs=[input_image],
83
+ label=label.capitalize(),
84
+ examples_per_page=1,
85
+ fn=predict,
86
+ outputs=[output_label],
87
+ )
88
  # Segunda fila
89
+ with gr.Row(elem_classes=["examples-row"]):
90
+ for example, label in zip(examples[5:], cifar10_labels[5:]):
91
+ gr.Examples(
92
+ examples=example,
93
+ inputs=[input_image],
94
+ label=label.capitalize(),
95
+ examples_per_page=1,
96
+ fn=predict,
97
+ outputs=[output_label],
98
+ )
99
 
100
  # Conectar eventos
101
  submit_btn.click(