Requests
api_key_safe_raise_for_status(response)
¶
Raise an exception if the request is not successful.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response
|
Response
|
The response of the request. |
required |
Source code in inference_sdk/http/utils/requests.py
11 12 13 14 15 16 17 18 19 20 21 |
|
deduct_api_key(match)
¶
Deduct the API key from the string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
match
|
Match
|
The match of the API key. |
required |
Returns:
Type | Description |
---|---|
str
|
The string with the API key deducted. |
Source code in inference_sdk/http/utils/requests.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
|
deduct_api_key_from_string(value)
¶
Deduct the API key from the string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
str
|
The string to deduct the API key from. |
required |
Returns:
Type | Description |
---|---|
str
|
The string with the API key deducted. |
Source code in inference_sdk/http/utils/requests.py
24 25 26 27 28 29 30 31 32 33 |
|
inject_images_into_payload(payload, encoded_images, key='image')
¶
Inject images into the payload.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
payload
|
dict
|
The payload to inject the images into. |
required |
encoded_images
|
List[Tuple[str, Optional[float]]]
|
The encoded images. |
required |
key
|
str
|
The key of the images. |
'image'
|
Returns:
Type | Description |
---|---|
dict
|
The payload with the images injected. |
Source code in inference_sdk/http/utils/requests.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
inject_nested_batches_of_images_into_payload(payload, encoded_images, key='image')
¶
Inject nested batches of images into the payload.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
payload
|
dict
|
The payload to inject the images into. |
required |
encoded_images
|
Union[list, Tuple[str, Optional[float]]]
|
The encoded images. |
required |
key
|
str
|
The key of the images. |
'image'
|
Returns:
Type | Description |
---|---|
dict
|
The payload with the images injected. |
Source code in inference_sdk/http/utils/requests.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|