Home
Requirements
Python versions 3.8 and 3.9 are supported
Installation
Basic installation:
Websocket and streaming features can be enabled with:
Basic Usage
Submit a new batch job
Note: Your personal API key can be found in the profile section of beta.hume.ai
from hume import HumeBatchClient
from hume.models.config import FaceConfig
client = HumeBatchClient("<your-api-key>")
urls = ["https://tinyurl.com/hume-img"]
config = FaceConfig(identify_faces=True)
job = client.submit_job(urls, [config])
print(job)
print("Running...")
result = job.await_complete()
result.download_predictions("predictions.json")
print("Predictions downloaded!")
Rehydrate a batch job from a job ID
from hume import HumeBatchClient
client = HumeBatchClient("<your-api-key>")
job_id = "<your-job-id>"
job = client.get_job(job_id)
print(job)
Stream predictions over a websocket
Note:
pip install hume[stream]
is required to use websocket features
import asyncio
from hume import HumeStreamClient
from hume.models.config import FaceConfig
async def main():
client = HumeStreamClient("<your-api-key>")
config = FaceConfig(identify_faces=True)
async with client.connect([config]) as socket:
result = await socket.send_file("<your-image-filepath>")
print(result)
asyncio.run(main())
Other Resources
Support
The Python SDK is open source! More details can be found on GitHub.
If you've found a bug with this SDK please open an issue!