Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -432,9 +432,16 @@ css = """
|
|
| 432 |
border-color: var(--primary-color);
|
| 433 |
}
|
| 434 |
|
| 435 |
-
.example-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 436 |
border-color: var(--primary-color);
|
| 437 |
-
|
| 438 |
}
|
| 439 |
"""
|
| 440 |
|
|
@@ -478,20 +485,16 @@ with gr.Blocks(theme="bethecloud/storj_theme", css=css) as demo:
|
|
| 478 |
value=example_images[0] if example_images else None # Set default image to in1.jpg
|
| 479 |
)
|
| 480 |
|
| 481 |
-
# Example images section
|
| 482 |
with gr.Row(elem_classes="example-images"):
|
|
|
|
|
|
|
| 483 |
for i in range(len(example_images)):
|
| 484 |
if example_images[i]:
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
height=90,
|
| 490 |
-
width=120,
|
| 491 |
-
elem_classes=f"example-image {'selected' if i == 0 else ''}"
|
| 492 |
-
).style(height=90, width=120)
|
| 493 |
-
# Add click event for each example image
|
| 494 |
-
example_btn.click(
|
| 495 |
fn=lambda idx=i: select_example(idx),
|
| 496 |
outputs=image
|
| 497 |
)
|
|
|
|
| 432 |
border-color: var(--primary-color);
|
| 433 |
}
|
| 434 |
|
| 435 |
+
.example-thumb {
|
| 436 |
+
border: 2px solid #ddd;
|
| 437 |
+
border-radius: 8px;
|
| 438 |
+
cursor: pointer;
|
| 439 |
+
transition: all 0.3s ease;
|
| 440 |
+
}
|
| 441 |
+
|
| 442 |
+
.example-thumb:hover {
|
| 443 |
border-color: var(--primary-color);
|
| 444 |
+
transform: translateY(-2px);
|
| 445 |
}
|
| 446 |
"""
|
| 447 |
|
|
|
|
| 485 |
value=example_images[0] if example_images else None # Set default image to in1.jpg
|
| 486 |
)
|
| 487 |
|
| 488 |
+
# Example images section with buttons instead of images with style
|
| 489 |
with gr.Row(elem_classes="example-images"):
|
| 490 |
+
# Create example buttons
|
| 491 |
+
example_buttons = []
|
| 492 |
for i in range(len(example_images)):
|
| 493 |
if example_images[i]:
|
| 494 |
+
btn = gr.Button(f"Example {i+1}", elem_classes="example-thumb")
|
| 495 |
+
example_buttons.append(btn)
|
| 496 |
+
# Add click event for each example button
|
| 497 |
+
btn.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 498 |
fn=lambda idx=i: select_example(idx),
|
| 499 |
outputs=image
|
| 500 |
)
|