Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -365,7 +365,16 @@ async def process_manual(
|
|
| 365 |
# Ensure it's a list of [x, y] coordinates
|
| 366 |
corners_list = []
|
| 367 |
for corner in corners_data:
|
| 368 |
-
if isinstance(corner,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 369 |
corners_list.append([float(corner[0]), float(corner[1])])
|
| 370 |
else:
|
| 371 |
raise ValueError(f"Invalid corner format: {corner}")
|
|
|
|
| 365 |
# Ensure it's a list of [x, y] coordinates
|
| 366 |
corners_list = []
|
| 367 |
for corner in corners_data:
|
| 368 |
+
if isinstance(corner, dict):
|
| 369 |
+
# Handle {x: ..., y: ...} format
|
| 370 |
+
if 'x' in corner and 'y' in corner:
|
| 371 |
+
corners_list.append([float(corner['x']), float(corner['y'])])
|
| 372 |
+
elif 0 in corner and 1 in corner:
|
| 373 |
+
corners_list.append([float(corner[0]), float(corner[1])])
|
| 374 |
+
else:
|
| 375 |
+
raise ValueError(f"Invalid corner dict format: {corner}")
|
| 376 |
+
elif isinstance(corner, (list, tuple)) and len(corner) == 2:
|
| 377 |
+
# Handle [x, y] format
|
| 378 |
corners_list.append([float(corner[0]), float(corner[1])])
|
| 379 |
else:
|
| 380 |
raise ValueError(f"Invalid corner format: {corner}")
|