File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change 1
- """ Use this script to inference the API with locally stored data"""
1
+ """Use this script to inference the API with locally stored data. """
2
2
3
3
import json
4
4
import os
8
8
PORT = os .getenv ("Landsat_PORT" , default = 5555 )
9
9
LANDSAT_ENDPOINT = f"http://localhost:{ PORT } /detections"
10
10
TIMEOUT_SECONDS = 60000
11
- SCENE_ID = ' LC09_L1GT_106084_20241002_20241002_02_T2'
12
- CROP_PATH = ' temp_crops'
11
+ SCENE_ID = " LC09_L1GT_106084_20241002_20241002_02_T2"
12
+ CROP_PATH = " temp_crops"
13
13
14
- def sample_request () -> None :
15
- """Sample request for files stored locally"""
16
14
15
+ def sample_request () -> None :
16
+ """Sample request for files stored locally."""
17
17
REQUEST_BODY = {
18
18
"scene_id" : SCENE_ID ,
19
19
"crop_path" : CROP_PATH ,
20
20
}
21
21
22
- response = requests .post (LANDSAT_ENDPOINT , json = REQUEST_BODY , timeout = TIMEOUT_SECONDS )
22
+ response = requests .post (
23
+ LANDSAT_ENDPOINT , json = REQUEST_BODY , timeout = TIMEOUT_SECONDS
24
+ )
23
25
output_filename = os .path .join (
24
26
os .path .dirname (os .path .realpath (__file__ )), "sample_response.json"
25
27
)
Original file line number Diff line number Diff line change 2
2
3
3
import json
4
4
from datetime import datetime , timedelta
5
+ from tempfile import TemporaryDirectory
5
6
from typing import Any
6
7
7
8
import numpy as np
@@ -183,8 +184,8 @@ def run_classifier(
183
184
184
185
def predict_pipeline (
185
186
crop_path : str ,
186
- scratch_path : Optional [ str ] = None ,
187
- json_path : Optional [ str ] = None ,
187
+ scratch_path : str | None = None ,
188
+ json_path : str | None = None ,
188
189
image_files : dict [str , str ] | None = None ,
189
190
scene_id : str | None = None ,
190
191
) -> dict [str , Any ]:
@@ -203,8 +204,6 @@ def predict_pipeline(
203
204
scene_id: Landsat scene ID. Exactly one of image_files or scene_id should be
204
205
specified.
205
206
"""
206
-
207
-
208
207
if not scratch_path :
209
208
tmp_dir = TemporaryDirectory ()
210
209
scratch_path = tmp_dir .name
You can’t perform that action at this time.
0 commit comments