Vulavula Logo
Overview

Quickstart Tutorials

Introducing an API solution tailored for Africa’s most widely spoken languages. This vulavula API offers transcription and sophisticated analysis capabilities, enabling seamless comprehension and integration. Are you ready to dive in? Let's go!

We recommend you checkout our Colab Tutorial to easily interact with the APIs.

Get your API Token

In order to get access to our API, you’re going to need an API token. Signup and login to the Vulavula Platform HERE. Generate a API token. This’ll be used to authenticate your requests.

Transcribe

Transcribe your audio files to text. This is the first step to unlocking the power of your audio data.

Setup

# Because our model sometimes go to sleep, we have implemented a retry to try again.
from retry_requests import retry
from requests import Session

# Get your VULAVULA_TOKEN by logging in and getting keys
VULAVULA_TOKEN = "<INSERT TOKEN HERE>"
# Our headers for authentication
headers={
    "X-CLIENT-TOKEN": VULAVULA_TOKEN,
    "Content-Type": "multipart/form-data"
}

# The Sync File Transcription endpoint accepts audio files and returns transcribed text within the same HTTP request/response cycle.
TRANSCRIBE_URL = "https://vulavula-services.lelapa.ai/api/v2alpha/transcribe/sync/file"

# Name of the file you are transcribing
FILE_TO_TRANSCRIBE = "<FILE TO TRANSCRIBE>"
python

Let's get transcribing

Language Selection

Optionally, you can specify a language code to specify which model you’re speaking on. The following language codes are valid:

  • Afrikaans = "afr"
  • isiZulu = "zul"
  • Sesotho = "sot"
  • South African English = "eng"
  • African French = "fra"

If no language code is specified, our built-in language ID will select the most probable language.

ufiles = {
    'file': ('audio.wav', file_data(FILE_TO_TRANSCRIBE), 'audio/wav')
}

# Optional parameters
params = {
    "lang_code": "<INSERT-LANGUAGE-CODE>",
    "diarise": 1,
}

resp = requests.post(TRANSCRIBE_URL, headers=headers, files=files, params=params)
pprint(resp.json())
python

Response:

{
  "id": "5f15e81b-53c2-4c5c-a779-1f6776100543",
  "storage_url": null,
  "container_name": "24-26",
  "blob_name": "[BLOB_NAME]",
  "customer_id": 24,
  "project_id": 26,
  "keychain_id": null,
  "upload_file_size": null,
  "audio_length_seconds": 134217.7279375,
  "sample_rate": null,
  "channels": null,
  "frame_rate": null,
  "mime_type": null,
  "language_code": "zul",
  "diarisation_result": {
    "ends": [],
    "starts": [],
    "speaker_ids": [],
    "words": []
  },
  "transcription_text": "Sample transcription text"
}
json

Analyse

Analyse your text to extract insights.

# Because our model sometimes go to sleep, we have implemented a retry to try again.
from retry_requests import retry
from requests import Session

SENTIMENT_URL = "https://vulavula-services.lelapa.ai/api/v1/sentiment_analysis/process"

sentence = "Ngijabulile!" # I am happy
headers={
    "X-CLIENT-TOKEN": VULAVULA_TOKEN,
}

# Get retry helper session
session = retry(Session(), retries=10, backoff_factor=1)

sentiment_resp = session.post(
    SENTIMENT_URL,
    json={"encoded_text": sentence},
    headers=headers,
)

sentiment_resp.json()
python

Response:

{
  "Id": "33abd8be-4a0c-4db8-947e-077ad5a88d8b",
  "Sentiments": [
    {
      "text": "Ngijabulile",
      "sentiment": [
        {
          "label": "positive",
          "score": 0.9990226030349731
        }
      ]
    }
  ]
}
json

Translate

Translate your text from one language to another. You can also translate to other languages by changing the source_lang and target_lang parameter:

  • Northern Sotho (nso_Latn)
  • Afrikaans (afr_Latn)
  • Southern Sotho (sot_Latn)
  • Swati (ssw_Latn)
  • Tsonga (tso_Latn)
  • Tswana (tsn_Latn)
  • Xhosa (xho_Latn)
  • Zulu (zul_Latn)
  • English (eng_Latn)
  • Swahili (swh_Latn)
# Because our model sometimes go to sleep, we have implemented a retry to try again.
from retry_requests import retry
from requests import Session

TRANSLATION_URL = "https://vulavula-services.lelapa.ai/api/v1/translate/process"

headers={
    "X-CLIENT-TOKEN": VULAVULA_TOKEN,
}

# Get retry helper session
session = retry(Session(), retries=10, backoff_factor=1)

payload = {
  "input_text": "Lo musho ubhalwe ngesiZulu.",
  "source_lang": "zul_Latn",
  "target_lang": "eng_Latn"
}

translation_resp = session.post(
    TRANSLATION_URL,
    json=payload,
    headers=headers,
)

translation_resp.json()
python

Response:

{
  "id": "deed7995-dcf4-4456-bd33-c92ca1d990ca",
  "translation": [
    {
      "translation_text": "This sentence is written in Zulu."
    }
  ]
}
json

Support

Struggling to get started? Check out our Colab Tutorial or Contact us and we’ll help you sort it out.