Skip to content

Commit cac9564

Browse files
authored
Merge pull request #42 from scaleapi/sasha/adjust_params
Sasha/adjust params
2 parents 14f11c4 + 25b4359 commit cac9564

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

nucleus/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
)
9393
from .constants import (
9494
NUCLEUS_ENDPOINT,
95+
DEFAULT_NETWORK_TIMEOUT_SEC,
9596
ERRORS_KEY,
9697
ERROR_ITEMS,
9798
ERROR_PAYLOAD,
@@ -658,7 +659,7 @@ def predict(
658659
Union[BoxPrediction, PolygonPrediction, SegmentationPrediction]
659660
],
660661
update: bool,
661-
batch_size: int = 100,
662+
batch_size: int = 5000,
662663
):
663664
"""
664665
Uploads model outputs as predictions for a model_run. Returns info about the upload.
@@ -1043,6 +1044,7 @@ def _make_grequest(
10431044
session=sess,
10441045
files=payload,
10451046
auth=(self.api_key, ""),
1047+
timeout=DEFAULT_NETWORK_TIMEOUT_SEC,
10461048
)
10471049
else:
10481050
post = requests_command(
@@ -1051,6 +1053,7 @@ def _make_grequest(
10511053
json=payload,
10521054
headers={"Content-Type": "application/json"},
10531055
auth=(self.api_key, ""),
1056+
timeout=DEFAULT_NETWORK_TIMEOUT_SEC,
10541057
)
10551058
return post
10561059

@@ -1074,6 +1077,7 @@ def _make_request_raw(
10741077
json=payload,
10751078
headers={"Content-Type": "application/json"},
10761079
auth=(self.api_key, ""),
1080+
timeout=DEFAULT_NETWORK_TIMEOUT_SEC,
10771081
)
10781082
logger.info("API request has response code %s", response.status_code)
10791083

nucleus/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
NUCLEUS_ENDPOINT = "https://api.scale.com/v1/nucleus"
2+
DEFAULT_NETWORK_TIMEOUT_SEC = 60
23
ITEMS_KEY = "items"
34
ITEM_KEY = "item"
45
REFERENCE_ID_KEY = "reference_id"

0 commit comments

Comments
 (0)