DEV Community

Adam Cameron Drummond
Adam Cameron Drummond

Posted on

Planespotter.py

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass

What I Built (with Copilot)

Planespotter is an offline chatbot that identifies aircraft from a vague description. You type something like "huge plane with a hump on the front and four engines" and it replies with "That's most likely a Boeing 747" and tells you what to check to be sure.

Some of the best places to watch planes, like fence lines, hilltops and the end of a runway, have poor signal or no Wi-Fi. A tool that needs the cloud fails there. This one runs entirely on your own machine, so it works wherever you can stand.

It's aimed at beginners who don't know the vocabulary yet. You don't need to say "high-wing twin turboprop with a T-tail". You can say "two propellers, wings on top", and the bot teaches the words as it goes. The point is to get you looking up at the sky and learning to read planes, not scrolling a screen.

Demo

Example interaction

You: i'm at the airport and i see a large plane with 2 engines on each side and a big hump at the front
Spotter: Sounds like you've got a great start! Based on your description, here are my top picks for the CANDIDATES:

1. **Boeing 747**: This seems like the most likely match, given your description of a large plane with a big hump at the front and 2 engines on each side. The 747 is an iconic wide-body aircraft with a distinctive upper deck, making it a great fit.
2. **Air Force One**: As a special mention, since it fits your description, it's worth noting that Air Force One is a Boeing 747-200B or 747-8, and it often carries 2 engines on each side.
3. **FedEx Boeing 747-8F**: Another possibility is the FedEx Boeing 747-8F, which is a variant of the 747-8 with a cargo-only configuration.

To help narrow it down, take a closer look at the following features:

* Engine count and placement: Are there 2 engines on each side, or are there more engines?
* Wing position: Are the wings positioned on the sides, or are they more offset?
* Size: Is the plane extremely large, or is it proportionally large?

Let me know if you have any more details or if you'd like me to ask a follow-up question!
Enter fullscreen mode Exit fullscreen mode

Code

How I Built It

There are two layers, and they work together.

  1. A local aircraft list. About 28 common aircraft (airliners, regional jets, turboprops, private planes, military planes and helicopters) are stored with their engine layout, size, distinctive features and common airlines.
  2. A local open-weight model through Ollama. The default is llama3.2:3b, which is small enough for a laptop. It is configurable through the PLANE_MODEL environment variable.

The flow for each message:

  1. Your description is turned into keywords, with plain-language synonyms mapped to the list's vocabulary ("humpback" to "hump", "chopper" to "helicopter", "twin" to 2 engines).
  2. The list is scored against those keywords, with engine and feature text weighted highest.
  3. The top three matches are given to the model as candidates. It picks the likeliest, explains which features to check, and asks a follow-up question if you're too vague.
  4. Earlier messages in the chat are kept, so a follow-up like "it had a T-tail" narrows things down.

I did it this way because small models are unreliable at recalling aircraft facts from memory. Giving the model a short list of real candidates means it only has to choose and explain, not remember. If Ollama isn't running, the app still prints the matches from the list, so it degrades gracefully.

So far I've checked the matching step on sample descriptions. "Hump and four engines" ranks the 747 first, "two propellers, high wing" ranks the ATR 72 first, and "wings on top with a strut" ranks the Cessna 172 first. Next I want to measure the full chat on a larger set of descriptions.

Why Does Open Innovation Matter?

An offline tool can't call a closed API. Without a connection, a hosted model is simply unavailable. An open-weight model I can download once and run locally made the whole idea possible.

It also does the following:

  • It's free to use. There are no per-question costs, so a beginner can ask hundreds of silly questions.
  • It's private and dependable. Nothing leaves the device, and the app can't break because a provider changes or retires a model.
  • It's changeable. I can swap in a different model, or a smaller one for a phone, with a single setting. Anyone can also add aircraft to the JSON file, such as local airlines and regional types, so the knowledge belongs to the community instead of a vendor. The next step is putting this on a phone, so the whole thing fits in your pocket at the airfield fence.

Prize Categories

  • Best Use of GitHub Copilot

Top comments (0)