DEV Community

Cover image for Building an AI Floor Planner with Google Gemini and Matplotlib
Bindupautra Jyotibrat
Bindupautra Jyotibrat

Posted on

Building an AI Floor Planner with Google Gemini and Matplotlib

Building an AI Floor Planner with Google Gemini

What I Built with Google Gemini

Designing floor plans usually requires architectural tools or manual drawing. I wanted to explore whether natural language could be used to generate a basic floor layout automatically.

So I built an AI-powered Floor Planning system that converts a simple text prompt into a structured floor plan visualization.

The workflow is simple:

  • The user provides a natural language prompt describing a floor layout.
    Example:

    "A 2 bedroom apartment with a living room, kitchen, and bathroom."

  • The prompt is sent to the Google Gemini API.

  • Gemini parses the prompt and converts it into a structured JSON layout containing room names, dimensions, and positions.

  • This JSON data is then used by Matplotlib to programmatically draw the floor plan.

Essentially, Gemini acts as the intelligent parser that converts human language into a structured format that the program can visualize.

Without an LLM, writing a rule-based parser for every possible description would be extremely difficult. Gemini makes this step far more flexible.

Architecture

The pipeline of the system looks like this:

User Prompt
     ↓
Google Gemini API
     ↓
Structured JSON Layout
     ↓
Python Processing
     ↓
Matplotlib Visualization
     ↓
Generated Floor Plan
Enter fullscreen mode Exit fullscreen mode

This project is implemented in Python inside a Jupyter Notebook, where the Gemini API generates the layout JSON and Matplotlib plots the rooms accordingly.

The goal of this prototype was to demonstrate how LLMs can act as a bridge between human language and structured spatial data.

Tech Stack

This project combines Large Language Models with traditional Python visualization tools to generate floor plans from natural language.

Technologies used:

  • Google Gemini API – Parses natural language prompts and converts them into structured JSON layouts.
  • Python – Core programming language used to build the system.
  • Matplotlib – Used to visualize the floor plan by plotting rooms as geometric shapes.
  • Jupyter Notebook – Used for development, experimentation, and running the pipeline interactively.

This combination allows the system to bridge natural language understanding (Gemini) with programmatic visualization (Matplotlib).

Demo

Example prompt:

Generate a small apartment floor plan layout.

Requirements:

  • 1 Living Room near the entrance
  • 2 Bedrooms on the right side of the layout
  • 1 Kitchen connected to the living room
  • 1 Bathroom located near the bedrooms

Gemini converts the description into structured JSON like:

{
  "rooms": [
    {"name": "Living Room", "x": 0, "y": 0, "width": 6, "height": 5},
    {"name": "Kitchen", "x": 0, "y": 5, "width": 3, "height": 3},
    {"name": "Bedroom 1", "x": 6, "y": 0, "width": 4, "height": 4},
    {"name": "Bedroom 2", "x": 6, "y": 4, "width": 4, "height": 4},
    {"name": "Bathroom", "x": 3, "y": 5, "width": 3, "height": 3}
  ]
}
Enter fullscreen mode Exit fullscreen mode

Using this JSON, Matplotlib plots the layout automatically, generating a visual floor plan.

AI-generated apartment floor plan created using Google Gemini and Matplotlib

The full implementation is available in the Jupyter Notebook used for this project.

What I Learned

Working on this project helped me understand several interesting aspects of LLM-powered systems.

  1. LLMs as Structured Data Generators

One of the biggest takeaways was how effectively Gemini can convert natural language into structured formats like JSON. Instead of building complex parsers, the model can interpret spatial descriptions and organize them logically.

  1. Prompt Engineering Matters

Small prompt adjustments significantly affected the output format. Clear instructions like "Return the output strictly in JSON format with coordinates and dimensions" made the system much more reliable.

  1. LLM + Traditional Programming is Powerful

Gemini handled the semantic understanding, while Python handled the visualization and computation. Combining LLMs with traditional libraries like Matplotlib opens up many creative possibilities.

  1. AI Can Simplify Design Interfaces

Projects like this hint at a future where architectural tools or design software could be controlled using natural language instead of complex UI tools.

What Worked Well

Gemini worked very well for:

  • Converting natural language prompts into structured JSON
  • Understanding spatial relationships between rooms
  • Following formatting instructions when prompted clearly
  • The model was also flexible enough to interpret different ways of describing layouts.

Where I Faced Friction

One challenge was ensuring consistent JSON formatting. Sometimes the response included extra text or formatting issues. This required refining the prompt to enforce strict JSON output.

Another limitation was that the model sometimes generated room overlaps or unrealistic layouts, which suggests that adding rule-based validation could improve the system.

Overall, building this project showed how powerful LLMs like Google Gemini can be when used as a structured reasoning engine rather than just a chatbot.

Using natural language to generate floor plans is just one example — but the same approach could be applied to many design, planning, or visualization problems.

Resources

Project Repository

Project Website (Frontend Demo)

Note: The backend for the project is not currently deployed, so some functionality on the website may not work. The site is intended to showcase the project architecture and design.

Survey Paper


Top comments (0)