whisper-medium

This documentation is valid for the following list of our models:

  • #g1_whisper-medium

Model Overview

The Whisper models are primarily for AI research, focusing on model robustness, generalization, and biases, and are also effective for English speech recognition. The use of Whisper models for transcribing non-consensual recordings or in high-risk decision-making contexts is strongly discouraged due to potential inaccuracies and ethical concerns.

The models are trained using 680,000 hours of audio and corresponding transcripts from the internet, with 65% being English audio and transcripts, 18% non-English audio with English transcripts, and 17% non-English audio with matching non-English transcripts, covering 98 languages in total.

Setup your API Key

If you don’t have an API key for the Apilaplas API yet, feel free to use our Quickstart guide.

Submit a request

API Schema

Creating and sending a speech-to-text conversion task to the server

post
Authorizations
Body
modelundefined · enumRequiredPossible values:
custom_intentany ofOptional
stringOptional
or
string[]Optional
custom_topicany ofOptional
stringOptional
or
string[]Optional
custom_intent_modestring · enumOptionalPossible values:
custom_topic_modestring · enumOptionalPossible values:
detect_languagebooleanOptional
detect_entitiesbooleanOptional
detect_topicsbooleanOptional
diarizebooleanOptional
dictationbooleanOptional
diarize_versionstringOptional
extrastringOptional
filler_wordsbooleanOptional
intentsbooleanOptional
keywordsstringOptional
languagestringOptional
measurementsbooleanOptional
multi_channelbooleanOptional
numeralsbooleanOptional
paragraphsbooleanOptional
profanity_filterbooleanOptional
punctuatebooleanOptional
searchstringOptional
sentimentbooleanOptional
smart_formatbooleanOptional
summarizestringOptional
tagstring[]Optional
topicsbooleanOptional
utterancesbooleanOptional
utt_splitnumberOptional
Responses
201Success
application/json
post
POST /v1/stt/create HTTP/1.1
Host: api.apilaplas.com
Authorization: Bearer <YOUR_LAPLASAPI_KEY>
Content-Type: application/json
Accept: */*
Content-Length: 593

{
  "model": "#g1_whisper-medium",
  "custom_intent": "text",
  "custom_topic": "text",
  "custom_intent_mode": "strict",
  "custom_topic_mode": "strict",
  "detect_language": true,
  "detect_entities": true,
  "detect_topics": true,
  "diarize": true,
  "dictation": true,
  "diarize_version": "text",
  "extra": "text",
  "filler_words": true,
  "intents": true,
  "keywords": "text",
  "language": "text",
  "measurements": true,
  "multi_channel": true,
  "numerals": true,
  "paragraphs": true,
  "profanity_filter": true,
  "punctuate": true,
  "search": "text",
  "sentiment": true,
  "smart_format": true,
  "summarize": "text",
  "tag": [
    "text"
  ],
  "topics": true,
  "utterances": true,
  "utt_split": 1
}
201Success
{
  "generation_id": "123e4567-e89b-12d3-a456-426614174000"
}

Requesting the result of the task from the server using the generation_id

Quick Code Examples

Let's use the #g1_whisper-medium model to transcribe the following audio fragment:

Example #1: Processing a Speech Audio File via URL

import time
import requests

base_url = "https://api.apilaplas.com/v1"
# Insert your LAPLAS API Key instead of <YOUR_LAPLASAPI_KEY>:
api_key = "<YOUR_LAPLASAPI_KEY>"

# Creating and sending a speech-to-text conversion task to the server
def create_stt():
    url = f"{base_url}/stt/create"
    headers = {
        "Authorization": f"Bearer {api_key}", 
    }

    data = {
        "model": "#g1_whisper-medium",
        "url": "https://audio-samples.github.io/samples/mp3/blizzard_primed/sample-0.mp3"
    }
 
    response = requests.post(url, json=data, headers=headers)
    
    if response.status_code >= 400:
        print(f"Error: {response.status_code} - {response.text}")
    else:
        response_data = response.json()
        print(response_data)
        return response_data

# Requesting the result of the task from the server using the generation_id
def get_stt(gen_id):
    url = f"{base_url}/stt/{gen_id}"
    headers = {
        "Authorization": f"Bearer {api_key}", 
    }
    response = requests.get(url, headers=headers)
    return response.json()
    
# First, start the generation, then repeatedly request the result from the server every 10 seconds.
def main():
    stt_response = create_stt()
    gen_id = stt_response.get("generation_id")


    if gen_id:
        start_time = time.time()

        timeout = 600
        while time.time() - start_time < timeout:
            response_data = get_stt(gen_id)

            if response_data is None:
                print("Error: No response from API")
                break
        
            status = response_data.get("status")

            if status == "waiting" or status == "active":
                ("Still waiting... Checking again in 10 seconds.")
                time.sleep(10)
            else:
                print("Processing complete:/n", response_data["result"]['results']["channels"][0]["alternatives"][0]["transcript"])
                return response_data
   
        print("Timeout reached. Stopping.")
        return None     


if __name__ == "__main__":
    main()
Response
{'generation_id': 'e3d46bba-7562-44a9-b440-504d940342a3'}
Processing complete:
 He doesn't belong to you and i don't see how you have anything to do with what is be his power yet he's he personified from this stage to you be fire

Example #2: Processing a Speech Audio File via File Path

import time
import requests

base_url = "https://api.apilaplas.com/v1"
# Insert your LAPLAS API Key instead of <YOUR_LAPLASAPI_KEY>:
api_key = "<YOUR_LAPLASAPI_KEY>"

# Creating and sending a speech-to-text conversion task to the server
def create_stt():
    url = f"{base_url}/stt/create"
    headers = {
        "Authorization": f"Bearer {api_key}", 
    }

    data = {
        "model": "#g1_whisper-medium",
    }
    with open("stt-sample.mp3", "rb") as file:
        files = {"audio": ("sample.mp3", file, "audio/mpeg")}
        response = requests.post(url, data=data, headers=headers, files=files)
    
    if response.status_code >= 400:
        print(f"Error: {response.status_code} - {response.text}")
    else:
        response_data = response.json()
        print(response_data)
        return response_data

# Requesting the result of the task from the server using the generation_id
def get_stt(gen_id):
    url = f"{base_url}/stt/{gen_id}"
    headers = {
        "Authorization": f"Bearer {api_key}", 
    }
    response = requests.get(url, headers=headers)
    return response.json()
    
# First, start the generation, then repeatedly request the result from the server every 10 seconds.
def main():
    stt_response = create_stt()
    gen_id = stt_response.get("generation_id")


    if gen_id:
        start_time = time.time()

        timeout = 600
        while time.time() - start_time < timeout:
            response_data = get_stt(gen_id)

            if response_data is None:
                print("Error: No response from API")
                break
        
            status = response_data.get("status")

            if status == "waiting" or status == "active":
                ("Still waiting... Checking again in 10 seconds.")
                time.sleep(10)
            else:
                print("Processing complete:/n", response_data["result"]['results']["channels"][0]["alternatives"][0]["transcript"])
                return response_data
   
        print("Timeout reached. Stopping.")
        return None     


if __name__ == "__main__":
    main()
Response
{'generation_id': 'dd412e9d-044c-43ae-b97b-e920755074d5'}
Processing complete:
 He doesn't belong to you and i don't see how you have anything to do with what is be his power yet he's he personified from this stage to you be fire

Last updated