Python client for Egrobots Arabic Speech Analysis service
Project description
Egrobots SA Client
Python client for Egrobots Arabic Speech Analysis service.
Installation
pip install egrobots-sa-client
Quick Start
from egrobots_sa_client import EgrobotsSSAClient
client = EgrobotsSSAClient()
# Conversation analysis
result = client.analyze(
audio="audio.mp3",
enable_translation=False # Set True for EN + AR
)
Configuration
Create a .env file:
BASE_URL=https://your-service.com
Features
- Conversation Analysis: Analyze audio conversations with speaker diarization
- Bilingual Support: Get responses in both English and Arabic
- Progress Tracking: Monitor upload and processing progress
- Retry Logic: Automatic retries for failed requests
Usage
Basic Analysis
from egrobots_sa_client import EgrobotsSSAClient
client = EgrobotsSSAClient()
# Analyze audio file
result = client.analyze(audio="audio.mp3")
print(result)
With Bilingual Support
result = client.analyze(
audio="audio.mp3",
enable_translation=True
)
# Check if bilingual
if client.is_bilingual_response(result):
en_result = client.extract_language_version(result, 'EN')
ar_result = client.extract_language_version(result, 'AR')
Using Audio Bytes
with open("audio.mp3", "rb") as f:
audio_bytes = f.read()
result = client.analyze(
audio=audio_bytes,
file_name="audio.mp3"
)
Progress Monitoring
def progress_handler(event_type, data):
print(f"[{event_type}] {data}")
result = client.analyze(
audio="audio.mp3",
progress_callback=progress_handler
)
API Reference
analyze()
Main method for conversation analysis.
Parameters:
audio(str | bytes): Path to audio file or audio bytesfile_name(str): Filename when using bytes (default: "audio.wav")enable_translation(bool): Enable EN + AR bilingual response (default: False)progress_callback(Callable): Progress handler functionmax_retries(int): Maximum retry attempts (default: 3)retry_delay(int): Delay between retries in seconds (default: 2)
Returns: Dict containing analysis results
Helper Methods
is_bilingual_response(result)- Check if response has EN/AR keysextract_language_version(result, language)- Extract 'EN' or 'AR' version
Documentation
See CLIENT_USAGE.md for full documentation.
License
MIT
Project details
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 egrobots_sa_client-2.0.1.tar.gz.
File metadata
- Download URL: egrobots_sa_client-2.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c336f2abe63c1cd6cf1c252b9af48cf7cebd4adfaf56707b0470049cf7e34f16
|
|
| MD5 |
4ded0c0eebfbcbd65c400a479eaf7666
|
|
| BLAKE2b-256 |
60f8fd046474dfeffa5ae419f98e138ed6cf43ca8a8e2d5b4fb7be9cca5dcf99
|
File details
Details for the file egrobots_sa_client-2.0.1-py3-none-any.whl.
File metadata
- Download URL: egrobots_sa_client-2.0.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3aa2e2f5f934bea93e9c80260b970abb5b6bc0ae80e08ca84cecf52b539a08e9
|
|
| MD5 |
76e0b8e70b94a2154787957f26dabddf
|
|
| BLAKE2b-256 |
ca01b8d206aa9eaa0f8073236c62e564e9006f18fef13b3bda23b65164aa61bc
|