Skip to content

Commit

Permalink
whisper models
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffj66 committed Sep 27, 2023
1 parent 6dce6a9 commit f24066d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 64 deletions.
17 changes: 16 additions & 1 deletion src/backend/engine/serviceCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,20 @@ const convertToChatCopilotService: BpaService = {
}
}

const whisperBatchService: BpaService = {
bpaServiceId: "abc123",
inputTypes: ["wav", "mp3", "mp4"],
outputTypes: ["whisper"],
name: "whisper",
process: speech.processWhisperBatch,
serviceSpecificConfig: {

},
serviceSpecificConfigDefaults: {

}
}

export const serviceCatalog = {
// "copy" : copyService,
//"redactPdf" : redactPdfService,
Expand Down Expand Up @@ -1201,6 +1215,7 @@ export const serviceCatalog = {
"formatKMAccelerator": formatKMAcceleratorService,
"jsonToText": jsonToTextService,
"piiStt": piiSttService,
"piiToOpenaiRest": piiToOpenaiRestService
"piiToOpenaiRest": piiToOpenaiRestService,
"whisper" : whisperBatchService
}

52 changes: 0 additions & 52 deletions src/backend/local.settings.example.json

This file was deleted.

19 changes: 9 additions & 10 deletions src/backend/services/speech.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as sdk from "microsoft-cognitiveservices-speech-sdk";
import { BpaServiceObject } from '../engine/types'
import { BlobServiceClient, ContainerClient, BlockBlobClient, ContainerGenerateSasUrlOptions, ContainerSASPermissions } from "@azure/storage-blob"

import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'
import { DB } from "./db";
import MessageQueue from "./messageQueue";
Expand Down Expand Up @@ -144,12 +143,12 @@ export class Speech {
sasUrl
],
"properties": {
"diarizationEnabled": true,
"wordLevelTimestampsEnabled": true,
"punctuationMode": "DictatedAndAutomatic",
"profanityFilterMode": "Masked"
"wordLevelTimestampsEnabled": false
},
"locale": "en-US",
"model": {
"self": process.env.WHISPER_MODEL//"https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/71cbd7af-3212-43ab-8695-666fb28ffef7"
},
"displayName": "Transcription of file using default model for en-US"
}
if (input?.serviceSpecificConfig?.to) {
Expand All @@ -158,11 +157,11 @@ export class Speech {
sasUrl
],
"properties": {
"diarizationEnabled": true,
"wordLevelTimestampsEnabled": true,
"punctuationMode": "DictatedAndAutomatic",
"profanityFilterMode": "Masked"
"wordLevelTimestampsEnabled": false
},
"model": {
"self": process.env.WHISPER_MODEL
},
"locale": input.serviceSpecificConfig.to,
"displayName": "Transcription of file using default model for en-US"
}
Expand All @@ -173,7 +172,7 @@ export class Speech {
"Ocp-Apim-Subscription-Key": process.env.SPEECH_SUB_KEY
}
}
axiosResp = await axios.post(process.env.SPEECH_SUB_ENDPOINT + 'speechtotext/v3.0/transcriptions', payload, axiosParams)
axiosResp = await axios.post(process.env.SPEECH_SUB_ENDPOINT + 'speechtotext/v3.1/transcriptions', payload, axiosParams)
//httpResult = axiosResp.status

input.aggregatedResults["speechToText"] = {
Expand Down
4 changes: 4 additions & 0 deletions templates/oneclick.json
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,10 @@
{
"name": "HUGGINGFACE_ENDPOINT",
"value": "[format('https://{0}.azurewebsites.net', parameters('functionAppNamePython'))]"
},
{
"name": "WHISPER_MODEL",
"value": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/71cbd7af-3212-43ab-8695-666fb28ffef7"
}
]
}
Expand Down
4 changes: 4 additions & 0 deletions templates/oneclickoai.json
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,10 @@
{
"name": "HUGGINGFACE_ENDPOINT",
"value": "[format('https://{0}.azurewebsites.net', parameters('functionAppNamePython'))]"
},
{
"name": "WHISPER_MODEL",
"value": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/71cbd7af-3212-43ab-8695-666fb28ffef7"
}
]
}
Expand Down
5 changes: 4 additions & 1 deletion templates/privatedeploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1563,8 +1563,11 @@
{
"name": "OPENAI_DEPLOYMENT_SEARCH_QUERY",
"value": "text-embedding-ada-002"
},
{
"name": "WHISPER_MODEL",
"value": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/71cbd7af-3212-43ab-8695-666fb28ffef7"
}

]
}
},
Expand Down

0 comments on commit f24066d

Please sign in to comment.