Build An Audio Transcriber and Analyzer utilizing ToolJet and OpenAI

Build An Audio Transcriber and Analyzer utilizing ToolJet and OpenAI

In this hands-on tutorial, we’ll learn to construct a strong audio transcriber and analyzer utilizing ToolJet and Open AI. We’ll rapidly design an intuitive UI utilizing ToolJet’s pre-built elements, after which use the platform’s question builder to work together with Open AI for audio transcription and evaluation.

By the top of this tutorial, we’ll have a elementary construction to construct extra subtle transcription and audio evaluation purposes.

Prerequisites:

  • ToolJet (https://github.com/ToolJet/ToolJet) : An open-source, low-code platform designed for rapidly constructing and deploying inside instruments. Sign up for a free ToolJet cloud account right here.
  • Open AI Account : Register for an Open AI account to make the most of AI-powered options in your ToolJet purposes. Sign up right here.

Here’s a fast preview of what we’re going to construct:

Image description

Before you start, go to the Open AI Console, and duplicate your secret key. Next, login to your ToolJet account, find the Data Sources part on the left sidebar, and configure Open AI as a knowledge supply utilizing the key key.

Image description

Once the information supply is configured, create a brand new app referred to as "Speech Insight" from the dashboard. And with that, we’re prepared to start out constructing our utility.

Step 1: Building the UI for the Audio Transcriber

Let’s use ToolJet’s visible app builder to design our UI.

  • For the app header, drag and drop an Icon element on the canvas. Navigate to its properties panel on the suitable, and choose the IconBrandDingtalk icon.
  • Drop a Text element subsequent to it, and enter "Speech Insight" underneath its Data property.
  • Change the colour of each elements to blue (#3E63DD). This would be the major coloration scheme of our app, replace the colour scheme of the remaining elements accordingly.

Image description

  • Place a Container element under the header. We will set up the upcoming elements contained in the Container element.
  • Rename it to importantContainer.

Image description

  • On the highest left of the Container element, place a Text element with the label "Output".
  • Below it, add one other Container and place two Text elements inside it. We will use these elements to show the transcribed textual content and suggestions. Name them transcribedText and suggestions respectively.
  • Add a File Picker element under it and rename it to uploader. Change its Accept file sorts property to "audio/*".
  • Place a Button element under it and rename it to analyzeButton and add an "Analyze Button" label to it.

Image description

Note: We are renaming key elements to make them simpler to reference in different elements of our utility.

  • Finally, place 4 Statistics elements on the suitable for Fluency, Pronunciation, Intonation, and Vocabulary scores.
  • Drop a Button element under it labeled "Copy Output" and rename it to copyButton.

Image description

The UI is now prepared! Time to configure the interactions with Open AI.

Step 2: Interact With Open AI

In the under steps, we’ll undergo the configuration to work together with Open AI utilizing each REST API and ToolJet’s native integration.

  • Expand the question panel on the backside and click on on the Add button to create a brand new REST API question. Rename the question to transcribe.
  • Enter the Open AI URL underneath the URL property: https://api.openai.com/v1/audio/transcriptions.
  • Add a brand new row underneath Header, enter Content-Type as the important thing and multipart/form-data as the worth.
  • Add one other key for Authorization. Enter Bearer <OPEN_AI_KEY> within the worth.

Image description

  • Under Body, add file as the important thing and worth as . This will make sure the audio file chosen in our uploader/File Picker element is distributed.
  • Add mannequin as the important thing and enter whisper-1 as the worth.

Image description

Now if we choose an audio file within the uploader/File Picker element and click on on the Run button, we’ll see the transcribed audio because the output.

Image description

Once the audio is transcribed, we have to analyze it to supply a rating. Let’s use the native Open AI integration for this question.

  • Click on the Add button and add a brand new question. Select Open AI as the information supply for this question. This is similar knowledge supply that we had arrange at the start. Rename it to analyze.
  • Select Chat because the operation and Message as enter, and enter the under immediate:
Based on the transcribed audio under, present a 
JSON object in response with the following particulars:

   - Fluency (out of 10)
   - Pronunciation (out of 10)
   - Vocabulary (out of 10)
   - Intonation (out of 10)
   - A paragraph that provides normal suggestions 
on the transcribed textual content's high quality and general enchancment solutions.
Return the article within the following format:
{fluency: "...", pronunciation: "...", vocabulary: "...", intonation: "...", suggestions: "..."}
Transcribed textual content:

Image description

In this immediate, we’re utilizing Open AI to carry out an in depth evaluation of the audio transcription. We are referencing the information returned by the transcribe question within the immediate together with different scoring standards.

Running this question will end result within the following output:

Image description

Both the queries are prepared. As a closing step, let’s automate the method of triggering the analyze question each time the transcribe question is efficiently executed.

  • Go again to the transcribe question, navigate to Events and add a brand new occasion handler.
  • Select Query Success because the Event, Run Query because the Action, and analyze because the Query.

Image description

By utilizing occasions, we’ve got arrange the method of triggering the analyze question after the transcribe question is triggered and is prepared with the output for evaluation.

Step 3: Binding the Transcripts and Analysis to Components

Onto the ultimate step. We have constructed our UI and in addition constructed queries to work together with Open AI. Now we will join all of it collectively and see the app in motion.

  • Select the Analyze Audio button, navigate to its properties panel on the suitable and add a brand new occasion.
  • Select On click on because the Event, Run Query because the Action, and transcribe because the Query.

Now each time the Analyze Audio button is clicked, it would set off the transcribe question.

  • Select the Copy Output button and add a brand new occasion to it.
  • Select On click on because the Event, Copy to clipboard because the Action, and because the Text.

This configuration will be certain that the analyzed output will get copied if you click on on the Copy Output button.

  • Select the Text element that we had positioned to show the transcript. Enter the next worth underneath its Data property:
    Transcript:

  • Select the Text element to show the suggestions. Enter the next worth underneath its Data property:
    Feedback:

Note: We acquired a JSON string in response to our analyze question. Therefore, we have to parse it to assemble a JavaScript object earlier than displaying it.

  • Select the Statistics element for "Fluency" and enter the under worth underneath its Primary worth property:

  • Update the remainder of the Statistics elements utilizing the identical logic.

Our audio transcriber and analyzer is now totally full. Upload an audio file and click on on the Analyze Audio button to see the transcription, suggestions, and scores getting populated within the UI.

Image description

Conclusion

In this tutorial, we discovered the best way to create an entire audio transcription and evaluation software utilizing ToolJet and OpenAI. We walked by designing an intuitive consumer interface, organising API queries to work together with OpenAI, and binding the outcomes to show transcriptions, suggestions, and speech evaluation scores.

To additional customise the applying, experiment with totally different UI elements to reinforce the consumer expertise or combine extra APIs to investigate different points of the audio, resembling emotion detection or language translation.

To be taught extra, try ToolJet’s official documentation or join on Slack for questions or queries.

HI-FI News

through DEV Community https://dev.to

August 29, 2024 at 02:09PM