static async Task Main(string[] args) { var config = new AppConfig().GetConfig(); string utterance = "what's up?"; string filePath = @"C:\Temp\Tricorder\etc\WP_20170520_17_30_04_Rich.jpg"; var extension = Path.GetExtension(filePath); using (var fileStream = File.Open(filePath, FileMode.Open)) { var storageManager = new Storage(config.StorageConfig); var blobUrl = storageManager.UploadFile(fileStream, extension); fileStream.Close(); fileStream.Dispose(); var analyzer = new Geordi(config); Geordi.AnalysisResult response = await analyzer.AnalyzeAsync(blobUrl, utterance); var modem = new Modem(config.ModemConfig); await modem.ProduceSpeechAsync(response.Result); Console.WriteLine(response.Log); var blobUri = new Uri(blobUrl); storageManager.DeleteFile(blobUri); } Console.ReadLine(); }
private async void btnAnalyze_Click(object sender, RoutedEventArgs e) { var utterance = string.IsNullOrWhiteSpace(txtUtterance.Text) ? "what's up?" : txtUtterance.Text; var analyzer = new Geordi(AppConfiguration); var stream = await picture.OpenAsync(FileAccessMode.Read); Geordi.AnalysisResult response = await analyzer.AnalyzeAsync(stream.AsStream(), utterance); var modem = new Modem(AppConfiguration.ModemConfig); var result = await modem.ProduceSpeechAsync(response.Result); Play(result); txtAnalysisResult.Text = response.Log; }
static async Task Main(string[] args) { var config = new AppConfig().GetConfig(); string utterance = "what's up?"; string filePath = @"C:\Temp\Tricorder\etc\WP_20170520_17_30_04_Rich.jpg"; using (var fileStream = File.Open(filePath, FileMode.Open)) { var analyzer = new Geordi(config); Geordi.AnalysisResult response = await analyzer.AnalyzeAsync(fileStream, utterance); var modem = new Modem(config.ModemConfig); await modem.ProduceSpeechAsync(response.Result); Console.WriteLine(response.Log); } Console.ReadLine(); }
private async void btnAnalyze_Click(object sender, RoutedEventArgs e) { var modem = new Modem(AppConfiguration.ModemConfig); if (string.IsNullOrWhiteSpace(txtFilePath.Text)) { var ssml = await Modem.BuildSsmlAsync("Please, either upload or take a new picture.", "en"); var speech = await modem.ProduceSpeechAsync(ssml); Play(speech); } if (string.IsNullOrWhiteSpace(txtUtterance.Text)) { txtUtterance.Text = "what's up?"; } string blobUrl = txtFilePath.Text; var utterance = txtUtterance.Text; var bitmapImage = new BitmapImage(new Uri(blobUrl, UriKind.Absolute)); imgPhoto.Source = bitmapImage; var analyzer = new Geordi(AppConfiguration); Geordi.AnalysisResult response = await analyzer.AnalyzeAsync(blobUrl, utterance); var result = await modem.ProduceSpeechAsync(response.Result); Play(result); txtAnalysisResult.Text = response.Log; DeletePicture(blobUrl); txtFilePath.Text = ""; }