Spaces:
Sleeping
Sleeping
Mobile refinements: widen table columns, horizontal bar chart, and replace SVG with PNG
Browse files- Add CSS to widen first column in markdown tables on mobile devices
- Convert bar chart to horizontal orientation for better mobile readability
- Update chart CSS to style y-axis labels properly for horizontal bars
- Replace kiki-bouba-image.svg with kiki-bouba-image.png
- Update image references in app.py and README.md
- README.md +1 -1
- app.py +47 -32
- kiki-bouba-image.png +0 -0
- kiki-bouba-image.svg +0 -29
README.md
CHANGED
|
@@ -21,7 +21,7 @@ license: mit
|
|
| 21 |
|
| 22 |
---
|
| 23 |
|
| 24 |
-
<img src="kiki-bouba-image.
|
| 25 |
|
| 26 |
*Which shape is "Kiki"? Which is "Bouba"? If you're like 95% of humans across all cultures, you already know.*
|
| 27 |
|
|
|
|
| 21 |
|
| 22 |
---
|
| 23 |
|
| 24 |
+
<img src="kiki-bouba-image.png" alt="The classic Kiki/Bouba shapes - a spiky angular shape (Kiki) and a rounded blob shape (Bouba)" width="450">
|
| 25 |
|
| 26 |
*Which shape is "Kiki"? Which is "Bouba"? If you're like 95% of humans across all cultures, you already know.*
|
| 27 |
|
app.py
CHANGED
|
@@ -180,24 +180,26 @@ def classify_image(image: Image.Image) -> tuple:
|
|
| 180 |
EXPLANATION_TEXT = """
|
| 181 |
## 🧠 The Phenomenon
|
| 182 |
|
| 183 |
-
In 1929, psychologist **Wolfgang Köhler** made a remarkable discovery. He showed people two abstract shapes—one spiky and angular, the other rounded and blobby—and asked them to name each with a nonsense word: either "takete" or "maluma."
|
| 184 |
|
| 185 |
-
|
| 186 |
|
| 187 |
-
This experiment was later refined by **V.S. Ramachandran and E.M. Hubbard (2001)** using the now-famous words **"Kiki"** and **"Bouba"**
|
| 188 |
|
| 189 |
| Shape | Sound | Agreement Rate |
|
| 190 |
|-------|-------|----------------|
|
| 191 |
| Angular, spiky | "Kiki" / "Takete" | **95-98%** |
|
| 192 |
| Rounded, blobby | "Bouba" / "Maluma" | **95-98%** |
|
| 193 |
|
| 194 |
-
|
| 195 |
- 🌍 Diverse cultures (Western, Eastern, indigenous)
|
| 196 |
- 👶 Ages (infants to elderly)
|
| 197 |
- 🔤 Languages with entirely different sound systems
|
| 198 |
- 👁️ Even among congenitally blind individuals (to a lesser degree)
|
| 199 |
|
| 200 |
-
It reveals something profound: **our senses are not as separate as we think**. Sound and shape share a hidden, abstract similarity that
|
|
|
|
|
|
|
| 201 |
|
| 202 |
---
|
| 203 |
|
|
@@ -207,14 +209,14 @@ This classifier uses **CLIP** (Contrastive Language-Image Pre-training) to compu
|
|
| 207 |
|
| 208 |
### Beyond Shape: A Cross-Modal Anchor System
|
| 209 |
|
| 210 |
-
The original Bouba/Kiki research focused on visual shapes. But subsequent research revealed that the effect extends far beyond geometry
|
| 211 |
|
| 212 |
- 🍋 Sour tastes are "Kiki"; sweet tastes are "Bouba"
|
| 213 |
- 🎵 High-pitched sounds are "Kiki"; low bass tones are "Bouba"
|
| 214 |
- ❄️ Cold sensations are "Kiki"; warm feelings are "Bouba"
|
| 215 |
- 😤 Tense emotions are "Kiki"; calm moods are "Bouba"
|
| 216 |
|
| 217 |
-
We leverage this insight by
|
| 218 |
|
| 219 |
---
|
| 220 |
|
|
@@ -292,14 +294,21 @@ This project builds on fascinating research at the intersection of cognitive sci
|
|
| 292 |
|
| 293 |
# Custom CSS for fixing padding, bar plot styling, colors, and label cutoff
|
| 294 |
custom_css = """
|
| 295 |
-
/* Bar plot container -
|
| 296 |
.bar-plot-container {
|
| 297 |
-
padding: 20px
|
| 298 |
overflow: visible !important;
|
| 299 |
box-sizing: border-box !important;
|
| 300 |
width: 100% !important;
|
| 301 |
}
|
| 302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 303 |
/* SVG container - ensure full visibility */
|
| 304 |
.bar-plot-container svg {
|
| 305 |
overflow: visible !important;
|
|
@@ -307,32 +316,29 @@ custom_css = """
|
|
| 307 |
height: auto !important;
|
| 308 |
}
|
| 309 |
|
| 310 |
-
/*
|
| 311 |
-
.bar-plot-container svg g.
|
| 312 |
-
.bar-plot-container svg g.
|
| 313 |
-
.bar-plot-container svg .
|
| 314 |
-
.bar-plot-container svg text[text-anchor="middle"] {
|
| 315 |
-
transform: rotate(-45deg) !important;
|
| 316 |
-
transform-origin: center center !important;
|
| 317 |
-
text-anchor: start !important;
|
| 318 |
overflow: visible !important;
|
| 319 |
white-space: nowrap !important;
|
| 320 |
-
|
| 321 |
}
|
| 322 |
|
| 323 |
-
/*
|
| 324 |
-
.bar-plot-container svg g.
|
| 325 |
-
.bar-plot-container svg g.
|
| 326 |
-
.bar-plot-container svg
|
| 327 |
-
.bar-plot-container svg g[class*="xtick"] {
|
| 328 |
overflow: visible !important;
|
| 329 |
-
|
| 330 |
}
|
| 331 |
|
| 332 |
-
/*
|
| 333 |
-
.bar-plot-container svg
|
| 334 |
-
|
| 335 |
-
|
|
|
|
|
|
|
| 336 |
}
|
| 337 |
|
| 338 |
/* Style bars for Kiki type - electric lime green */
|
|
@@ -342,6 +348,15 @@ custom_css = """
|
|
| 342 |
fill: var(--bar-color, #3B82F6) !important;
|
| 343 |
}
|
| 344 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
/* Use JavaScript injection to color bars based on labels */
|
| 346 |
"""
|
| 347 |
|
|
@@ -477,11 +492,11 @@ with gr.Blocks(title="Kiki/Bouba Classifier") as demo:
|
|
| 477 |
value="<p>Results will appear here after classification.</p>"
|
| 478 |
)
|
| 479 |
|
| 480 |
-
# BarPlot with
|
| 481 |
anchor_plot = gr.BarPlot(
|
| 482 |
label="Top Anchor Similarities",
|
| 483 |
-
x="
|
| 484 |
-
y="
|
| 485 |
title="Most Relevant Characteristics",
|
| 486 |
height=450,
|
| 487 |
container=True,
|
|
@@ -495,7 +510,7 @@ with gr.Blocks(title="Kiki/Bouba Classifier") as demo:
|
|
| 495 |
gr.Markdown("---")
|
| 496 |
gr.HTML("""
|
| 497 |
<div style="text-align: center; margin: 20px 0;">
|
| 498 |
-
<img src="file/kiki-bouba-image.
|
| 499 |
<p style="font-style: italic; color: #888; margin-top: 10px;">
|
| 500 |
Which shape is "Kiki"? Which is "Bouba"? If you're like 95% of humans across all cultures, you already know.
|
| 501 |
</p>
|
|
|
|
| 180 |
EXPLANATION_TEXT = """
|
| 181 |
## 🧠 The Phenomenon
|
| 182 |
|
| 183 |
+
In 1929, psychologist **Wolfgang Köhler** made a remarkable discovery. He showed people two abstract shapes — one spiky and angular, the other rounded and blobby — and asked them to name each with a nonsense word: either "takete" or "maluma."
|
| 184 |
|
| 185 |
+
The result was striking: across languages, cultures, and ages, people overwhelmingly assigned the same names to the same shapes. The sharp, angular figure was "takete." The soft, curvy one was "maluma."
|
| 186 |
|
| 187 |
+
This experiment was later refined by **V.S. Ramachandran and E.M. Hubbard (2001)** using the now-famous words **"Kiki"** and **"Bouba"**, and the results held:
|
| 188 |
|
| 189 |
| Shape | Sound | Agreement Rate |
|
| 190 |
|-------|-------|----------------|
|
| 191 |
| Angular, spiky | "Kiki" / "Takete" | **95-98%** |
|
| 192 |
| Rounded, blobby | "Bouba" / "Maluma" | **95-98%** |
|
| 193 |
|
| 194 |
+
The **Bouba/Kiki effect** has been replicated across:
|
| 195 |
- 🌍 Diverse cultures (Western, Eastern, indigenous)
|
| 196 |
- 👶 Ages (infants to elderly)
|
| 197 |
- 🔤 Languages with entirely different sound systems
|
| 198 |
- 👁️ Even among congenitally blind individuals (to a lesser degree)
|
| 199 |
|
| 200 |
+
It reveals something profound: **our senses are not as separate as we think**. Sound and shape share a hidden, abstract similarity that we instinctively recognize.
|
| 201 |
+
|
| 202 |
+
**And wherever there's abstract similarity, there's a great opportunity to mess around with embeddings!**
|
| 203 |
|
| 204 |
---
|
| 205 |
|
|
|
|
| 209 |
|
| 210 |
### Beyond Shape: A Cross-Modal Anchor System
|
| 211 |
|
| 212 |
+
The original Bouba/Kiki research focused on visual shapes. But subsequent research revealed that the effect extends far beyond geometry. It's **cross-modal**, involving taste, texture, temperature, emotion, and more:
|
| 213 |
|
| 214 |
- 🍋 Sour tastes are "Kiki"; sweet tastes are "Bouba"
|
| 215 |
- 🎵 High-pitched sounds are "Kiki"; low bass tones are "Bouba"
|
| 216 |
- ❄️ Cold sensations are "Kiki"; warm feelings are "Bouba"
|
| 217 |
- 😤 Tense emotions are "Kiki"; calm moods are "Bouba"
|
| 218 |
|
| 219 |
+
We leverage this insight by curating **~200 anchor words** across **9 sensory domains** to classify images. This allows the model to capture not just the literal shape, but the *gestalt*: the overall quality or character of an image.
|
| 220 |
|
| 221 |
---
|
| 222 |
|
|
|
|
| 294 |
|
| 295 |
# Custom CSS for fixing padding, bar plot styling, colors, and label cutoff
|
| 296 |
custom_css = """
|
| 297 |
+
/* Bar plot container - padding adjusted for horizontal bars */
|
| 298 |
.bar-plot-container {
|
| 299 |
+
padding: 20px 20px 20px 200px !important;
|
| 300 |
overflow: visible !important;
|
| 301 |
box-sizing: border-box !important;
|
| 302 |
width: 100% !important;
|
| 303 |
}
|
| 304 |
|
| 305 |
+
/* Mobile: reduce left padding for smaller screens */
|
| 306 |
+
@media (max-width: 768px) {
|
| 307 |
+
.bar-plot-container {
|
| 308 |
+
padding: 20px 10px 20px 120px !important;
|
| 309 |
+
}
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
/* SVG container - ensure full visibility */
|
| 313 |
.bar-plot-container svg {
|
| 314 |
overflow: visible !important;
|
|
|
|
| 316 |
height: auto !important;
|
| 317 |
}
|
| 318 |
|
| 319 |
+
/* Y-axis labels (anchor names) - ensure readability */
|
| 320 |
+
.bar-plot-container svg g.ytick text,
|
| 321 |
+
.bar-plot-container svg g.yaxis text,
|
| 322 |
+
.bar-plot-container svg .y-axis text {
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
overflow: visible !important;
|
| 324 |
white-space: nowrap !important;
|
| 325 |
+
text-anchor: end !important;
|
| 326 |
}
|
| 327 |
|
| 328 |
+
/* X-axis labels (scores) - no rotation needed for horizontal bars */
|
| 329 |
+
.bar-plot-container svg g.xtick text,
|
| 330 |
+
.bar-plot-container svg g.xaxis text,
|
| 331 |
+
.bar-plot-container svg .x-axis text {
|
|
|
|
| 332 |
overflow: visible !important;
|
| 333 |
+
white-space: nowrap !important;
|
| 334 |
}
|
| 335 |
|
| 336 |
+
/* Ensure axis containers have enough space */
|
| 337 |
+
.bar-plot-container svg g.yaxis,
|
| 338 |
+
.bar-plot-container svg g.ytick,
|
| 339 |
+
.bar-plot-container svg g[class*="y-axis"],
|
| 340 |
+
.bar-plot-container svg g[class*="ytick"] {
|
| 341 |
+
overflow: visible !important;
|
| 342 |
}
|
| 343 |
|
| 344 |
/* Style bars for Kiki type - electric lime green */
|
|
|
|
| 348 |
fill: var(--bar-color, #3B82F6) !important;
|
| 349 |
}
|
| 350 |
|
| 351 |
+
/* Mobile: Widen first column in tables */
|
| 352 |
+
@media (max-width: 768px) {
|
| 353 |
+
.markdown table th:first-child,
|
| 354 |
+
.markdown table td:first-child {
|
| 355 |
+
min-width: 150px !important;
|
| 356 |
+
width: auto !important;
|
| 357 |
+
}
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
/* Use JavaScript injection to color bars based on labels */
|
| 361 |
"""
|
| 362 |
|
|
|
|
| 492 |
value="<p>Results will appear here after classification.</p>"
|
| 493 |
)
|
| 494 |
|
| 495 |
+
# BarPlot with horizontal bars for mobile readability
|
| 496 |
anchor_plot = gr.BarPlot(
|
| 497 |
label="Top Anchor Similarities",
|
| 498 |
+
x="Score",
|
| 499 |
+
y="Anchor",
|
| 500 |
title="Most Relevant Characteristics",
|
| 501 |
height=450,
|
| 502 |
container=True,
|
|
|
|
| 510 |
gr.Markdown("---")
|
| 511 |
gr.HTML("""
|
| 512 |
<div style="text-align: center; margin: 20px 0;">
|
| 513 |
+
<img src="file/kiki-bouba-image.png" alt="The classic Kiki/Bouba shapes" style="max-width: 400px; width: 100%;">
|
| 514 |
<p style="font-style: italic; color: #888; margin-top: 10px;">
|
| 515 |
Which shape is "Kiki"? Which is "Bouba"? If you're like 95% of humans across all cultures, you already know.
|
| 516 |
</p>
|
kiki-bouba-image.png
ADDED
|
kiki-bouba-image.svg
DELETED