Update app.py
Browse files
app.py
CHANGED
|
@@ -45,7 +45,11 @@ examples = [
|
|
| 45 |
]
|
| 46 |
|
| 47 |
# Construir interfaz
|
| 48 |
-
with gr.Blocks(theme=gr.themes.Soft(), css="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
| 71 |
gr.Markdown("## Ejemplos de categor铆as")
|
| 72 |
-
with gr.Column():
|
| 73 |
# Primera fila
|
| 74 |
-
with gr.Row():
|
| 75 |
-
for
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
# Segunda fila
|
| 85 |
-
with gr.Row():
|
| 86 |
-
for
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 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(
|