Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,15 +70,8 @@ def predict(image):
|
|
| 70 |
# Get all example images
|
| 71 |
example_images = glob.glob("All/*")
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
["All/Captura de pantalla 2025-10-08 110957.png"],
|
| 76 |
-
["All/Captura de pantalla 2025-10-08 111037.png"],
|
| 77 |
-
["All/cigar.jpg"],
|
| 78 |
-
["All/fotonoticia_20120215131819_1200.jpg"],
|
| 79 |
-
["All/Joos_van_Craesbeeck_-_The_Smoker.jpg"],
|
| 80 |
-
["All/a-group-of-young-people-at-a-party-taking-a-selfie-photo.jpg"]
|
| 81 |
-
]
|
| 82 |
|
| 83 |
# Function to get random sample
|
| 84 |
def get_random_sample():
|
|
@@ -112,17 +105,19 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 112 |
with gr.Column():
|
| 113 |
output_label = gr.Label(num_top_classes=2, label="Prediction")
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
|
| 124 |
gr.Markdown(
|
| 125 |
"""
|
|
|
|
|
|
|
| 126 |
### About this model
|
| 127 |
|
| 128 |
- **Architecture:** ResNet34 + LoRA adapters (rank=8)
|
|
|
|
| 70 |
# Get all example images
|
| 71 |
example_images = glob.glob("All/*")
|
| 72 |
|
| 73 |
+
examples = [[img] for img in example_images[:12]] # Takes the 12 images
|
| 74 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
# Function to get random sample
|
| 77 |
def get_random_sample():
|
|
|
|
| 105 |
with gr.Column():
|
| 106 |
output_label = gr.Label(num_top_classes=2, label="Prediction")
|
| 107 |
|
| 108 |
+
gr.Markdown("### 📸 Try these examples:")
|
| 109 |
+
gr.Examples(
|
| 110 |
+
examples=examples,
|
| 111 |
+
inputs=input_image,
|
| 112 |
+
outputs=output_label,
|
| 113 |
+
fn=predict,
|
| 114 |
+
cache_examples=True
|
| 115 |
+
)
|
| 116 |
|
| 117 |
gr.Markdown(
|
| 118 |
"""
|
| 119 |
+
===================================================================================================
|
| 120 |
+
|
| 121 |
### About this model
|
| 122 |
|
| 123 |
- **Architecture:** ResNet34 + LoRA adapters (rank=8)
|