Skip to content

Commit

Permalink
python & C# batch sample tune (#364)
Browse files Browse the repository at this point in the history
* tune python samples
* C# batch sample
  • Loading branch information
chlandsi authored Aug 26, 2019
1 parent 8cb07ed commit 68e88f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
13 changes: 8 additions & 5 deletions samples/batch/csharp/program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ class Program
// <batchdefinition>
// Replace with your subscription key
private const string SubscriptionKey = "<YourSubscriptionKey>";

// Update with your service region
private const string HostName = "<YourServiceRegion>.cris.ai";
private const int Port = 443;

// recordings and locale
private const string Locale = "en-US";
private const string RecordingsBlobUri = "<SAS URI pointing to an audio file stored in Azure Blob Storage>";


// For usage of baseline models, no acoustic and language model needs to be specified.
private static Guid[] modelList = new Guid[0];
Expand Down Expand Up @@ -99,22 +98,26 @@ static async Task TranscribeAsync()
}
completed++;

// if the transcription was successfull, check the results
// if the transcription was successful, check the results
if (transcription.Status == "Succeeded")
{
var resultsUri0 = transcription.ResultsUrls["channel_0"];

WebClient webClient = new WebClient();

var filename = Path.GetTempFileName();
webClient.DownloadFile(resultsUri0, filename);
var results0 = File.ReadAllText(filename);
var resultObject0 = JsonConvert.DeserializeObject<RootObject>(results0);
Console.WriteLine(results0);

Console.WriteLine("Transcription succeeded. Results: ");
Console.WriteLine(results0);
}
else
{
Console.WriteLine("Transcription failed. Status: {0}", transcription.StatusMessage);
}
break;

case "Running":
Expand Down
5 changes: 4 additions & 1 deletion samples/python/console/intent_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
"""
Intent recognition samples for the Microsoft Cognitive Services Speech SDK
"""

import time

Expand Down Expand Up @@ -188,7 +191,7 @@ def recognizing_callback(evt):


def recognize_intent_continuous():
"""performs one-shot intent recognition from input from an audio file"""
"""performs continuous intent recognition from input from an audio file"""
# <IntentContinuousRecognitionWithFile>
intent_config = speechsdk.SpeechConfig(subscription=intent_key, region=intent_service_region)
audio_config = speechsdk.audio.AudioConfig(filename=lampfilename)
Expand Down
4 changes: 2 additions & 2 deletions samples/python/console/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def select():
print('select sample module, {} to abort'.format(eofkey))
modules = list(samples.keys())
for i, module in enumerate(modules):
print(i, module.__name__)
print("{}: {}\n\t{}".format(i, module.__name__, module.__doc__.strip()))

try:
num = int(input())
Expand All @@ -54,7 +54,7 @@ def select():

print('select sample function, {} to abort'.format(eofkey))
for i, fun in enumerate(samples[selected_module]):
print(i, fun.__name__)
print("{}: {}\n\t{}".format(i, fun.__name__, fun.__doc__))

try:
num = int(input())
Expand Down
3 changes: 3 additions & 0 deletions samples/python/console/speech_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
"""
Speech recognition samples for the Microsoft Cognitive Services Speech SDK
"""

import time
import wave
Expand Down
3 changes: 3 additions & 0 deletions samples/python/console/translation_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
"""
Translation recognition samples for the Microsoft Cognitive Services Speech SDK
"""

import time

Expand Down

0 comments on commit 68e88f0

Please sign in to comment.