Python SDK for Behavioral Signals API
Project description
Behavioral Signals Python SDK
Python SDK for the Behavioral Signals API. Behavioral Signals builds AI solutions that understand human behavior through voice and detect deepfake content in audio. Our API enables developers to integrate behavioral analysis into their applications, both in batch and streaming modes.
Table of Contents
API Key Setup
To use the Behavioral Signals API, you need to create an account and obtain an API key from the Behavioral Signals portal.
SDK Installation
pip install behavioralsignals
SDK Example Usage
After obtaining your API key, you can use the SDK to interact with the Behavioral Signals APIs. We currently provide two main APIs:
- the Behavioral API for analyzing human behavior through voice, and
- the Deepfakes API for detecting deepfake audio content in human speech.
Both APIs support batch and streaming modes, allowing you to send audio files or streams for analysis and receive results in real-time or after processing.
You can also find more detailed examples for both batch and streaming in the examples/ directory.
Behavioral API Batch Mode
In batch mode, you can send audio files to the Behavioral Signals API for analysis. The API will return a unique process ID (PID) that you can use to retrieve the results later.
from behavioralsignals import Client
client = Client(YOUR_CID, YOUR_API_KEY)
response = client.behavioral.upload_audio(file="audio.wav")
output = client.behavioral.get_result(pid=response["pid"])
Behavioral API Streaming Mode
In streaming mode, you can send audio data in real-time to the Behavioral Signals API. The API will return results as they are processed.
from behavioralsignals import Client, StreamingOptions
from behavioralsignals.utils import make_audio_stream
client = Client(YOUR_CID, YOUR_API_KEY)
audio_stream, sample_rate = make_audio_stream("audio.wav", chunk_size=250)
options = StreamingOptions(sample_rate=sample_rate, encoding="LINEAR_PCM")
for result in client.behavioral.stream_audio(audio_stream=audio_stream, options=options):
print(result)
Deepfakes API Batch Mode
A similar example for the Deepfakes API in batch mode allows you to send audio files for deepfake detection:
from behavioralsignals import Client
client = Client(YOUR_CID, YOUR_API_KEY)
response = client.deepfakes.upload_audio(file="audio.wav")
output = client.deepfakes.get_result(pid=response["pid"])
Deepfakes API Streaming Mode
A similar streaming example for the Deepfakes API allows you to send audio data in real-time for speech deepfake detection:
from behavioralsignals import Client, StreamingOptions
from behavioralsignals.utils import make_audio_stream
client = Client(YOUR_CID, YOUR_API_KEY)
audio_stream, sample_rate = make_audio_stream("audio.wav", chunk_size=250)
options = StreamingOptions(sample_rate=sample_rate, encoding="LINEAR_PCM")
for result in client.deepfakes.stream_audio(audio_stream=audio_stream, options=options):
print(result)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file behavioralsignals-0.1.0.tar.gz.
File metadata
- Download URL: behavioralsignals-0.1.0.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
894cf3b1517b32c2a8457a3507946e91ca70476f9e4abb092462dab3daaf211e
|
|
| MD5 |
196b9f75d79c45c1b3a277fe1d58cae0
|
|
| BLAKE2b-256 |
2d816b6a0c4e06b10a1d368f20a4838d1f5b249ffb79e10fa6a48d8416ae4ccc
|
File details
Details for the file behavioralsignals-0.1.0-py3-none-any.whl.
File metadata
- Download URL: behavioralsignals-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a981e891bad2c37e94cbf0aefd838636345386b16a5923a2eba3b0bf1ad6eed7
|
|
| MD5 |
d8962bcd13055e47c9ec170977f101ed
|
|
| BLAKE2b-256 |
d3305869adbb619f52362d09faca6b7cccc567c5f1cf5abe442650d74cc96add
|