Skip to content

Commit

Permalink
Merge pull request #8 from hotosm/hotfix/bug-orthogonalize
Browse files Browse the repository at this point in the history
HOTFIX : Bug on API endpoint for orthogonalize
  • Loading branch information
kshitijrajsharma authored Mar 27, 2024
2 parents 4e34ded + 3981304 commit 3182f94
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
6 changes: 1 addition & 5 deletions API/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ class PredictionRequest(BaseModel):
description="Indicates whether to use JOSM query. Defaults to False.",
)

merge_adjacent_polygons: Optional[bool] = Field(
True,
description="Merges adjacent self-intersecting or containing each other polygons. Defaults to True.",
)

confidence: Optional[int] = Field(
50,
description="Threshold probability for filtering out low-confidence predictions. Defaults to 50.",
Expand Down Expand Up @@ -196,6 +191,7 @@ async def predict_api(request: PredictionRequest):
skew_tolerance=request.skew_tolerance,
tolerance=request.tolerance,
area_threshold=request.area_threshold,
orthogonalize=request.use_josm_q,
)
return predictions
except Exception as e:
Expand Down
3 changes: 2 additions & 1 deletion API/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fastapi==0.103.2
uvicorn==0.22.0
fairpredictor==0.0.32
tflite-runtime==2.14.0
tflite-runtime==2.14.0
tensorflow==2.9.2
4 changes: 2 additions & 2 deletions predictor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def predict(
tile_overlap_distance=0.15,
use_raster2polygon=False,
remove_metadata=True,
use_josm_q=False,
orthogonalize=False,
max_angle_change=15,
skew_tolerance=15,
):
Expand Down Expand Up @@ -100,7 +100,7 @@ def predict(
for feature in prediction_geojson_data["features"]:
feature["properties"]["building"] = "yes"
feature["properties"]["source"] = "fAIr"
if use_josm_q is True:
if orthogonalize is True:
feature["geometry"] = othogonalize_poly(
feature["geometry"],
maxAngleChange=max_angle_change,
Expand Down

0 comments on commit 3182f94

Please sign in to comment.