|
5 | 5 | import gc |
6 | 6 | import os |
7 | 7 | from contextlib import asynccontextmanager |
8 | | -from typing import Dict, List |
| 8 | +from typing import Dict, List, Annotated |
9 | 9 |
|
10 | 10 | import geopandas as gpd |
11 | 11 | import mlflow |
@@ -93,21 +93,21 @@ def show_welcome_page(): |
93 | 93 |
|
94 | 94 | @app.get("/find_image", tags=["Find Image"]) |
95 | 95 | async def find_image( |
96 | | - gps_point: List[float] = Query(..., description="[longitude, latitude] in WGS84"), |
| 96 | + gps_point: Annotated[List[float], Query(min_length=2, max_length=2, description="[latitude, longitude] in WGS84")], |
97 | 97 | nuts_id: str = Query(...), |
98 | 98 | year: int = Query(2021, ge=2018, le=2024) |
99 | 99 | ) -> str: |
100 | 100 | """ |
101 | 101 | Find image path for a given NUTS3 and year. |
102 | 102 |
|
103 | 103 | Args: |
104 | | - gps_point (List[float]): [longitude, latitude] of the GPS point in WGS84. |
| 104 | + gps_point (List[float]): [latitude, longitude] of the GPS point in WGS84. |
105 | 105 | nuts_id (str): The ID of the NUTS. |
106 | 106 | year (int): The year of the satellite images. |
107 | 107 | Returns: |
108 | 108 | str: Image filepath if found, otherwise empty string. |
109 | 109 | """ |
110 | | - lon_gps, lat_gps = gps_point[0], gps_point[1] |
| 110 | + lat_gps, lon_gps = gps_point[0], gps_point[1] |
111 | 111 | logger.info(f"Find the image filepath for this gps point: {lon_gps}, {lat_gps}") |
112 | 112 | gc.collect() |
113 | 113 |
|
|
0 commit comments