Tag Archives: c

Blazor Simple AI Project (Part 5)

Azure Open AI Chat Audio Recoding Button

Welcome to the Blazor Simple AI Single Page App, Part 5 of the Microsoft AI services journey, which now includes an audio recording button in the Open AI Chat component.

This document explains the project in my GitHub repository which is available here: https://github.com/tejinderrai/public/tree/main/BlazorSimpleAI

If you would like to download the whole series of posts for the Blazor Simple AI Project, you can download the PDF here.

Visual Changes

The audio button has been added to the index.razor page as this is the main landing page. The audio button component is part of Radzen Blazor and simple to interact with which is the RadzenSpeechToTextButton. This utilises JavaScript as a component itself, there is an API to get user media.

For further information on the Razden Blazor Speech To Text Button, see: Blazor SpeechToTextButton Component | Free UI Components by Radzen.

Landing Page

The new landing page has the audio button added next to the chat text box.

When you click on the audio button, the first instance will provide a prompt requesting access from the site to the devices microphone, then recording has started as shown below.

When you are finished speaking, you click the button to stop recording and the text is submitted to the Question string and a OnChange event occurs and the Question value is set, then the state is changed for the component. Since the Question string is a bound field to the child component, AzureOpenAIChat, which then executes the component code to call the Microsoft Azure Open AI service with the text that was bound to the Question string.

An example of the recorded audio text and Azure Open AI response is shown below.

Code Changes

The following code changes were made in index.razor.

Added audio recoding button and spacing.

<Radzen.Blazor.RadzenSpeechToTextButton class="padding-right:10px;" Change="@(args => OnSpeechCaptured(args, "SpeechToTextButton"))" />
<div style="padding-left:10px;" />

Added the OnSpeechCaptured method.

Note: I removed the question marks and period from the string return from the Radzen Speech To Text button as the characters were automatically to the returned text string value from the component.

private void OnSpeechCaptured(string speechValue, string name)

{

    speechValue = speechValue.Trim(new Char[] { '.', '?' });

    RecordedSpeech = speechValue;

    Question = RecordedSpeech;

    this.StateHasChanged();

}

For my next post, I will be utilising the RadzenSpeechToTextButton for a different purpose in the Blazor Simple AI project.

BLAZOR JARVIS AI – Document Redaction Tool

Welcome to JARVIS, the AI document redaction processor. At the time of publishing this version of his document, I was still developing Jarvis as a fully working product. The current version supports word documents and PDFs. With the development of Blazor Simple AI, I can also utilise the image analysis component to redact PII information from images..

If you would like to download a PDF of this post, you can download it here.

Jarvis is made up of the following technologies:

  • Microsoft .NET Blazor (.NET 6.0 LTS release)
  • Microsoft Azure Cognitive Services (Text Analytics Service)
  • Microsoft Azure Cosmos DB (for maintaining document and redaction processor metadata)
  • Azure Web App (hosting the JARVIS AI Web App)
  • Azure Storage (source document upload and redaction storage)
  • Microsoft Azure Function App (for APIs that process PII data and perform redaction processing)
  • Radzen Blazor components (for an amazing UI experience)

A document named “IPAddressandNamesx10Pages.docx” contains the following information, repeated within 10 pages.

——————————————————————————————————————————-

The IP Address if the legacy system is 10.254.1.1.

The company that owns the legacy system is Microsoft.

The original founders of the company Microsoft are Bill Gates and Paul Allen.

——————————————————————————————————————————-

The document is uploaded to Jarvis, the AI Document redaction processor.

The user clicks “Process” to determine the PII and confidential data held in the document.

A notification is sent to the user to advise the document has been submitted for processing.

About 3 seconds later Jarvis has identified the PII and confidential data in the document and provides a notification to the user.

The user can then click “View” and then select which data needs to be redacted from the document.

The user then clicks “Save choices”. This will save the collection of choices, the metadata, to Azure Cosmos DB.

The user then clicks “Redact” and the user is notified of the submission and completion.

The user clicks the download button which is available after the redaction process has completed. The document is displayed with the information redacted using Microsoft Office apps (this can be downloaded to the machine directly also).

The process is going to be made simpler by a set of walkthroughs in the UI which will be a set of steps with instructions, including a preview document component.

Look out for the next update soon.