iplotnor's picture
Update README.md
639a376 verified

A newer version of the Gradio SDK is available: 6.14.0

Upgrade
metadata
title: House Model Detaction
emoji: 🏃
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.25.2
app_file: app.py
pinned: false

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

Architectural Floor Plan Analyzer

This Hugging Face Space allows users to upload PDF floor plans and get detailed room-level information in structured JSON format. The application uses Google's Gemini Pro Vision model to analyze the floor plans and extract structured data.

Features

  • Upload PDF floor plans
  • Extract images from PDFs
  • Analyze floor plans using Gemini Pro Vision
  • Get structured JSON output with room details
  • Optional description field for additional context

Setup Instructions

1. Create a Hugging Face Space

  1. Go to Hugging Face
  2. Click on "Create new Space"
  3. Select "Gradio" as the SDK
  4. Choose a name for your Space (e.g., "floor-plan-analyzer")
  5. Set Space visibility (Public or Private)
  6. Create the Space

2. Add Environment Variables

You need to add your Gemini API key as an environment variable:

  1. Go to your Space's settings
  2. Click on "Repository secrets"
  3. Add a new secret:

3. Upload Files

Upload the following files to your Space:

  • app.py (the main application)
  • requirements.txt (dependencies)

You can do this through the Hugging Face web interface or by pushing to the git repository.

Usage

  1. Open your Hugging Face Space
  2. Upload a PDF floor plan
  3. (Optional) Add a description with additional details
  4. Click "Analyze Floor Plan"
  5. View the extracted images and JSON output

JSON Output Format

The output is a structured JSON array with detailed room information:

[
  {
    "name": "Room name",
    "area_m2": 0.0,
    "position": "approximate location (e.g., north, south-east corner)",
    "dimensions_m": {
      "width": 0.0,
      "length": 0.0
    },
    "windows": 0,
    "window_positions": ["north wall", "east wall"],
    "doors": 0,
    "door_positions": ["interior", "to terrace"],
    "connected_rooms": ["Room A", "Room B"],
    "has_external_access": true,
    "ceiling_height_m": 2.4,
    "furniture": ["sofa", "kitchen island"],
    "estimated": false
  }
]

Limitations

  • The quality of the analysis depends on the clarity and quality of the uploaded floor plan
  • The application works best with clearly labeled floor plans
  • Large or complex floor plans may take longer to process
  • Gemini may need to estimate some values if they're not explicitly labeled in the plan

Troubleshooting

  • If you encounter errors related to the API key, ensure the GEMINI_API_KEY environment variable is set correctly
  • If the PDF fails to process, try converting it to a clearer format or using a different PDF
  • For any other issues, check the error messages in the application output