HumeBatchClient
Bases: ClientBase
Batch API client.
Example
from hume import HumeBatchClient
from hume.models.config import FaceConfig
client = HumeBatchClient("<your-api-key>")
urls = ["<your-image-url>"]
config = FaceConfig(identify_faces=True)
job = client.submit_job(urls, [configs])
print(job)
print("Running...")
result = job.await_complete()
result.download_predictions("predictions.json")
print("Predictions downloaded!")
Source code in hume/_batch/hume_batch_client.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
__init__(api_key, *args, **kwargs)
Construct a HumeBatchClient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key |
str
|
Hume API key. |
required |
get_api_type()
classmethod
Get the ApiType of the client.
Returns:
Name | Type | Description |
---|---|---|
ApiType |
ApiType
|
API type of the client. |
get_job(job_id)
Rehydrate a job based on a Job ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
ID of the job to rehydrate. |
required |
Returns:
Name | Type | Description |
---|---|---|
BatchJob |
BatchJob
|
Job associated with the given ID. |
get_job_result(job_id)
Get the result of the batch job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_id |
str
|
Job ID. |
required |
Raises:
Type | Description |
---|---|
HumeClientException
|
If the job result cannot be loaded. |
Returns:
Name | Type | Description |
---|---|---|
BatchJobResult |
BatchJobResult
|
Batch job result. |
Source code in hume/_batch/hume_batch_client.py
submit_job(urls, configs)
Submit a job for batch processing.
Only one config per model type should be passed.
If more than one config is passed for a given model type, only the last config will be used.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
urls |
List[str]
|
List of URLs to media files to be processed. |
required |
configs |
List[ModelConfigBase]
|
List of model config objects to run on each media URL. |
required |
Returns:
Name | Type | Description |
---|---|---|
BatchJob |
BatchJob
|
The |