# Custom ASR

Custom ASR enables users to integrate and test their own Automatic Speech Recognition (ASR) APIs with Datasaur projects. To enable this feature in your workspace, contact us at **<support@datasaur.ai>**.

## Configuring Custom ASR

### **Step 1: Set Up the Sample API**

1. Open the provided CodeSandbox example API [here](https://codesandbox.io/p/sandbox/datasaur-sample-custom-api-yf8g6p).
   * To test this code, you can also create a live endpoint using [codesandbox.io](http://codesandbox.io/).
2. Save any changes to the codebase to automatically create a fork for further testing and modifications.
3. Copy the **base URL** of the API from the CodeSandbox preview panel (on the right-hand side). In addition, you may need to ensure the panel is expanded if it’s collapsed.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-a8234a2fdde35c69d3f962550ca18e5cd4b6d38f%2FCustom%20ASR%20-%20CodeSandbox.png?alt=media" alt=""><figcaption></figcaption></figure>
4. In the sample API that we provided, you can use the following endpoints based on your needs:
   * <mark style="color:red;">`{baseUrl}/text-extraction/example-text`</mark> (returns plain text transcription).
   * <mark style="color:red;">`{baseUrl}/text-extraction/example-json`</mark> (returns Importable JSON transcription).

### **Step 2: Add Custom API in Project Creation Wizard**

1. Go to the **Active projects** page and click **“Create project".**

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-86c29dd3ce7c46b99fb83cd9a616b08010b76315%2FProjects%20-%20active%20projects.png?alt=media" alt=""><figcaption></figcaption></figure>
2. In **Step 1: Upload**, upload your image/PDF (for OCR) or audio file (for ASR) and click **Next.**
3. In **Step 2: Preview**, click the dropdown labeled **“Apply ASR Method”** (or **“Apply OCR Method”** for images/PDFs).

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-7df43b9fe093be7d7e40f477848c3ce39ea4062d%2FPCW%20-%20Step%202%20-%20audio%20labeling%20-%20audio%20preview%20-%20apply%20ASR%20method.png?alt=media" alt=""><figcaption></figcaption></figure>
4. Select **“+ Add New API…”** to open a dialog box.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-4577d0eb117b849f457e695d7ff4d23a317d8cbf%2FPCW%20-%20Step%202%20-%20audio%20labeling%20-%20audio%20preview%20-%20apply%20ASR%20method%20-%20dropdown.png?alt=media" alt=""><figcaption></figcaption></figure>

   * Fill in the fields:

     * **Name:** Desired name for the API.
     * **Custom API URL:** Paste one of the two endpoints from our sample API.
     * **Secret:** Add any placeholder value (this can be ignored for now).

     <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-cd6b8509c4479e8179641c35515cb8157b3b2a90%2FPCW%20-%20Step%202%20-%20audio%20labeling%20-%20add%20custom%20ASR%20API%20dialog.png?alt=media" alt=""><figcaption></figcaption></figure>
5. Click **Save** to add and select the API.
6. Review the sample transcription on the right panel.

   <figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-2760c049c5551aafa44b7e0d19d8f566bceee250%2FPCW%20-%20Step%202%20-%20audio%20labeling%20-%20audio%20preview%20-%20apply%20ASR%20method%20changed.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Step 3: Create the Project**

Once the API is added, complete the remaining project configuration steps to create the project and use the transcription results.

<figure><img src="https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-4ded718a9b324db5a70b7a985c1fe1028c55aa38%2FProject%20-%20audio%20labeling%20-%20labeled.png?alt=media" alt=""><figcaption></figcaption></figure>

## ASR Sample File

{% file src="<https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-84338de20b4630578209d11b8e58c2bf3df18939%2FDatasaur%20sample%20-%20ASR.mp3?alt=media&token=f9117b46-c6ef-4fa8-b765-92ac3f746d09>" %}

{% file src="<https://448889121-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbjY0HseEqu7LtYAt4d%2Fuploads%2Fgit-blob-a2266ed4e577b811339eeb855b10f883c6bc9966%2FDatasaur%20sample%20-%20Custom%20ASR%20(result).json?alt=media&token=472c0be9-a614-43b4-9547-82f300da9d8a>" %}

## Whisper ASR Limitations

<table data-full-width="false"><thead><tr><th width="263">Factor</th><th>Description</th></tr></thead><tbody><tr><td>Accepted file formats</td><td>.wav, .mp3, .m4a</td></tr><tr><td>Maximum individual file size</td><td>25 MB</td></tr><tr><td>Request limit (Azure)</td><td>100 RPM</td></tr><tr><td>Request timeout</td><td>10 minutes</td></tr><tr><td>Maximum API call retries</td><td>2 retries on request errors (e.g., rate limit reached, timeout).</td></tr></tbody></table>

## Amazon Transcribe ASR Limitations

<table><thead><tr><th width="272.546875">Factor</th><th>Description</th></tr></thead><tbody><tr><td>Accepted file formats</td><td>.flac, .m4a, .mp3, .wav</td></tr><tr><td>Maximum individual file size</td><td>130 MB</td></tr><tr><td>Maximum audio duration</td><td>14,400 seconds</td></tr></tbody></table>
