Download floorplan_editor/__init__.py from aakash9684/vastu-plan-generation: direct link, hf CLI and curl.
- Browser
- Download file 879 Bytes
-
https://huggingface.co/spaces/aakash9684/vastu-plan-generation/resolve/main/floorplan_editor/__init__.py
- Command line
-
hf download hf://spaces/aakash9684/vastu-plan-generation/floorplan_editor/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/aakash9684/vastu-plan-generation/resolve/main/floorplan_editor/__init__.py
879 Bytes
| import os | |
| import streamlit.components.v1 as components | |
| _COMPONENT_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "frontend") | |
| _floorplan_editor = components.declare_component( | |
| "floorplan_editor", | |
| path=_COMPONENT_DIR, | |
| ) | |
| def floor_plan_editor(rooms, plot_w, plot_h, road_side, key=None): | |
| """ | |
| Interactive drag-and-drop floor plan editor component. | |
| rooms: list of Room objects with .name, .x, .y, .w, .h attributes | |
| Returns list of updated room dicts {name, x, y, w, h} or None if no changes applied. | |
| """ | |
| room_dicts = [ | |
| {"name": r.name, "x": float(r.x), "y": float(r.y), "w": float(r.w), "h": float(r.h)} | |
| for r in rooms | |
| ] | |
| return _floorplan_editor( | |
| rooms=room_dicts, | |
| plot_w=float(plot_w), | |
| plot_h=float(plot_h), | |
| road_side=road_side, | |
| key=key, | |
| default=None, | |
| ) | |