Helper module to streamline access to Nijta's API
Project description
NijtaIO
The nijtaio library provides helper functions to streamline access to Nijta's API for Python application. It includes helper functions to prepare and retrieve the audio data.
You can find usage examples in our API reference and the Nijta samples repository.
Installation
You can install the module using pip:
pip install nijtaio
Basic Usage
import os
import json
import time
import nijtaio
TOKEN = '<token>'
API_URL = 'https://api.nijta.com'
headers = {"Content-Type": "application/json; charset=utf-8", "TOKEN":TOKEN}
params = {
'language':'french_8',
'gender':'f',
'voice':True,
'content':True
}
output_folder = 'output'
session_id = nijtaio.session(TOKEN, api_url=API_URL)
response = nijtaio.send_request(["path/to/audio_1.wav",
"path/to/audio_2.wav"],
params,session_id,
headers=headers,
api_url=API_URL)
task_id = json.loads(response.content)['data']['task_id']
print('Waiting for the batch to be processed.')
while True:
time.sleep(1)
status, anonymized_batch = nijtaio.read_response(task_id, api_url=API_URL)
if status == 'finished':
break
print(f'Writing results in {output_folder}.')
for original_filepath in anonymized_batch:
filename = os.path.basename(original_filepath)
with open(os.path.join(output_folder, filename), mode='wb') as f:
f.write(anonymized_batch[original_filepath]['audio'])
if params['content']:
print(filename, anonymized_batch[original_filepath]['transcription'])
print(f'Done. Check the results in the {output_folder} directory.')
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 nijtaio-1.1.13.tar.gz.
File metadata
- Download URL: nijtaio-1.1.13.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aa4df56dd7d0a9ef7acd01b13ce45c629daf0234b736aa80d42c34c66b2a58d
|
|
| MD5 |
556af4eebd84aa31b7c3fb31a4627147
|
|
| BLAKE2b-256 |
8d32f9e73fdfa0061a7a516c5d9ecbff69666c8b608206f9c407a8234768355c
|
File details
Details for the file nijtaio-1.1.13-py3-none-any.whl.
File metadata
- Download URL: nijtaio-1.1.13-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
993954604bed5d3869fddfdeb973ffa0c00abba8d5759116dea50057c99bf379
|
|
| MD5 |
67258c0e3bbd4be961177866f9f89843
|
|
| BLAKE2b-256 |
21cce9864bbf171bb39a57352ae79eb167da2212aef0797f5868b154229fe139
|