Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,9 +109,9 @@ def classify_zip_and_analyze_color(zip_file):
|
|
| 109 |
except Exception:
|
| 110 |
continue
|
| 111 |
|
| 112 |
-
# Thumbnail for gallery (
|
| 113 |
thumb = image.copy()
|
| 114 |
-
thumb
|
| 115 |
thumbnails.append(thumb)
|
| 116 |
|
| 117 |
# Classification
|
|
@@ -258,7 +258,14 @@ demo = gr.Interface(
|
|
| 258 |
outputs=[
|
| 259 |
gr.Dataframe(headers=["Filename", "Top 3 Predictions", "Confidence", "Dominant Color", "Basic Color", "Face Info"]),
|
| 260 |
gr.File(label="Download XLSX"),
|
| 261 |
-
gr.Gallery(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 262 |
gr.Image(type="pil", label="Basic Color Frequency"),
|
| 263 |
gr.Image(type="pil", label="Top Prediction Distribution"),
|
| 264 |
gr.Image(type="pil", label="Gender Distribution (Weighted ≤90%)"),
|
|
|
|
| 109 |
except Exception:
|
| 110 |
continue
|
| 111 |
|
| 112 |
+
# Thumbnail for gallery (keep aspect ratio)
|
| 113 |
thumb = image.copy()
|
| 114 |
+
thumb.thumbnail((200, 200), Image.LANCZOS)
|
| 115 |
thumbnails.append(thumb)
|
| 116 |
|
| 117 |
# Classification
|
|
|
|
| 258 |
outputs=[
|
| 259 |
gr.Dataframe(headers=["Filename", "Top 3 Predictions", "Confidence", "Dominant Color", "Basic Color", "Face Info"]),
|
| 260 |
gr.File(label="Download XLSX"),
|
| 261 |
+
gr.Gallery(
|
| 262 |
+
label="Thumbnails",
|
| 263 |
+
show_label=True,
|
| 264 |
+
elem_id="thumbnail-gallery",
|
| 265 |
+
columns=5,
|
| 266 |
+
object_fit="contain", # no warping
|
| 267 |
+
square=False # keep aspect ratio
|
| 268 |
+
),
|
| 269 |
gr.Image(type="pil", label="Basic Color Frequency"),
|
| 270 |
gr.Image(type="pil", label="Top Prediction Distribution"),
|
| 271 |
gr.Image(type="pil", label="Gender Distribution (Weighted ≤90%)"),
|