Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦠 Blob Oracle

Capture a day in the life of a slime mold aka Physarum polycephalum aka The BlobTM, read its wanderings, and whisper the findings to a mythic LLM that answers like a pocket oracle.

What's a blob?

Physarum polycephylum is a unicellular slime mold. It's famous for being very smart, despite having no brain or nervous system. It can find routes through mazes and build transport networks.

In this project, we're using the blob's intelligence to give us real life advice. We make it choose between two oats and interpret its movements and preferences as a whimsical premonition.

Step by step

  1. 📸 Conjure Starlight Raspberry Pi + Picamera2 timelapse → data/raw/ raw

  2. 🪄 Alchemy of Shadows — Black & White Convert & segment to BW → data/bw/ bw

  3. 🌿 Trail of Tendrils — Growth Masks Compute per-frame new growth masks → data/analysis/growth_masks/ bw

  4. 🔭 Reading the Rings — Analysis Measure approach/lead/alignment → data/analysis/growth_summary.json

  5. 🔮 Whisper to the Blob Oracle Build a poetic prompt and ask an LLM (local or OpenRouter) → data/analysis/prophecy.txt

Project layout (core scripts):

blob/
  capture.py   # Pi timelapse (Picamera2)
  bw.py        # black & white conversion (your original thresholds/logic)
  growth.py    # per-frame new-growth masks (seed+oats excluded)
  analyze.py   # scene detect, distances, leader logic, summary JSON
  oracle.py    # prompt builder + LLM client (local PC or OpenRouter)
run.py         # the spellbook (orchestrates the whole journey)

Data folders are configurable, defaulting to:

data/
  raw/
  bw/
  analysis/
    growth_masks/
    growth_summary.json
    prophecy.txt

🌙 Full ritual guide

A) OpenRouter (cloud)

# on the Pi
export OPENROUTER_API_KEY=sk-or-...   # required once per shell
python run.py summon --backend openrouter --stream --hours 24 --interval 300

B) Local PC relay (LAN)

On your PC:

python server.py

On your Pi:

python run.py summon --backend local --pc-ip 192.168.1.123 --hours 24 --interval 300

🧷 Installation (Pi)

  • Create and activate a venv
  • Install Python deps (typical): numpy, opencv-python, requests.

Minimal example:

python -m venv venv
source venv/bin/activate
pip install numpy opencv-python requests

If you're using the local PC relay, your PC also needs flask and openai (for the local OpenAI-compatible server client):

pip install flask openai

⚙️ Configuration

Environment variables (optional; CLI flags override):

Timing & folders

HOURS=24
INTERVAL=300
DATA_ROOT=data
RAW_FOLDER=raw
BW_FOLDER=bw
ANALYSIS_FOLDER=analysis

Camera (capture)

CAM_WIDTH=3840
CAM_HEIGHT=2160
JPEG_QUALITY=90

Local (PC relay) backend

ORACLE_BACKEND=local
ORACLE_PC_IP=192.168.1.123
ORACLE_SERVER_PORT=5000

OpenRouter backend

OPENROUTER_API_KEY=sk-or-...
OR_MODEL=openai/gpt-oss-20b
OR_TEMP=1.0
OR_BASE_URL=https://openrouter.ai/api/v1

Temperature: higher = more whimsical/creative (e.g., 1.0); lower = safer/straighter (e.g., 0.5).

🪄 Whimsical UX

  • Spells: python run.py summon (also accepts prophesize, 🍄, shimmer)
  • Whimsical banners for each step. Toggle with --no-whimsy or WHIMSY=0.
  • The spell sets friendly defaults (24h, 5-min interval, OpenRouter if key is present, streaming on).

Examples:

python run.py summon
python run.py summon --hours 0.05 --interval 120
python run.py summon --backend local --pc-ip 192.168.1.123
python run.py --no-whimsy summon

🔧 Common commands

Run just capture (Pi + camera):

python -m blob.capture --out data/raw --hours 0.1 --interval 120 \
  --width 3840 --height 2160 --quality 90

Run just BW:

python -m blob.bw --in data/raw --out data/bw

Run just growth masks:

python -m blob.growth --bw-dir data/bw --out-dir data/analysis/growth_masks

Run just analysis:

python -m blob.analyze \
  --bw-dir data/bw \
  --growth-dir data/analysis/growth_masks \
  --out-dir data/analysis

Ask the oracle only (OpenRouter):

python -m blob.oracle --backend openrouter --json data/analysis/growth_summary.json --stream

Ask the oracle only (local PC):

python -m blob.oracle --backend local --json data/analysis/growth_summary.json --pc-ip 192.168.1.123

🧭 Design notes

  • BW conversion uses your exact thresholds and CLAHE+Otsu flow.
  • Growth masks track expansion frame-by-frame, subtract seed & oat regions.
  • Analysis reproduces your original logic: dish detection, distances to oats, leader timeline, contact frames, alignment fractions, compact JSON.
  • Oracle never reveals raw labels; it renames oats into poetic "paths" and writes a short, imagistic prophecy.

Inspiration

This!

About

Blob Oracle ✨ (Submission for the OpenAI Open Model Hackathon)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages