Skip to content

Commit 02ab349

Browse files
committed
fastapi is working now
1 parent 19421b5 commit 02ab349

File tree

2 files changed

+3
-49
lines changed

2 files changed

+3
-49
lines changed

landsat/example_request.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
PORT = os.getenv("Landsat_PORT", default=5555)
99
LANDSAT_ENDPOINT = f"http://localhost:{PORT}/detections"
10-
TIMEOUT_SECONDS = 60000
10+
TIMEOUT_SECONDS = 200000
1111
SCENE_ID = "LC09_L1GT_106084_20241002_20241002_02_T2"
1212
CROP_PATH = "/home/yawenz/rslearn_projects/landsat/temp_crops"
1313
SCRATCH_PATH = "/home/yawenz/rslearn_projects/landsat/temp_scratch"

rslp/api_main.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""VIIRS Vessel Detection Service."""
1+
"""Landsat Vessel Detection Service."""
22

33
from __future__ import annotations
44

@@ -47,24 +47,10 @@ class LandsatRequest(BaseModel):
4747
scratch_path: str
4848
json_path: str
4949

50-
# class Config:
51-
# """example configuration for a request where files are stored in cloud"""
52-
53-
# schema_extra = {
54-
# "example": {
55-
# "input_dir": "input",
56-
# "output_dir": "output",
57-
# "filename": "VJ102DNB.A2022362.0154.021.2022362055600.nc",
58-
# "geo_filename": "VJ103DNB.A2022362.0154.021.2022362052511.nc",
59-
# "modraw_filename": "VJ102MOD.A2022362.0154.002.2022362115107.nc",
60-
# "modgeo_filename": "VJ103MOD.A2022362.0154.002.2022362095104.nc",
61-
# },
62-
# }
63-
6450

6551
@app.on_event("startup")
6652
async def rslp_init() -> None:
67-
"""VIIRS Vessel Service Initialization."""
53+
"""Landsat Vessel Service Initialization."""
6854
logger.info("Initializing")
6955

7056

@@ -90,38 +76,6 @@ async def get_detections(info: LandsatRequest, response: Response) -> LandsatRes
9076
logger.error(f"Error during prediction pipeline: {e}")
9177
return LandsatResponse(status=["error"], predictions=[])
9278

93-
# ves_detections = all_detections["vessel_detections"]
94-
95-
# satellite_name = utils.get_provider_name(dnb_dataset)
96-
# acquisition_time, end_time = utils.get_acquisition_time(dnb_dataset)
97-
# chips_dict = utils.get_chips(image, ves_detections, dnb_dataset)
98-
# if info.gcp_bucket is not None:
99-
# chips_dict = utils.upload_image(
100-
# info.gcp_bucket, chips_dict, info.output_dir, dnb_path
101-
# )
102-
# else:
103-
# utils.save_chips_locally(
104-
# chips_dict,
105-
# destination_path=info.output_dir,
106-
# chip_features=ves_detections,
107-
# )
108-
109-
# average_moonlight = RoundedFloat(utils.get_average_moonlight(dnb_dataset), 2)
110-
111-
# frame_extents = utils.get_frame_extents(dnb_dataset)
112-
113-
# predictions = utils.format_detections(chips_dict)
114-
# time_s = round(perf_counter() - start)
115-
# n_ves = len(chips_dict)
116-
# logger.info(
117-
# f"In frame: {dnb_path}, vvd detected {n_ves} vessels in ({time_s} seconds)"
118-
# )
119-
# response.headers["n_detections"] = str(len(chips_dict))
120-
# response.headers["avg_moonlight"] = str(average_moonlight)
121-
# response.headers["lightning_count"] = str(all_detections["lightning_count"])
122-
# response.headers["gas_flare_count"] = str(all_detections["gas_flare_count"])
123-
# response.headers["inference_time"] = str("elapsed_time")
124-
12579

12680
if __name__ == "__main__":
12781
uvicorn.run("api_main:app", host=HOST, port=PORT, proxy_headers=True)

0 commit comments

Comments
 (0)