0

I am using whisper .net in ASP.NET Core 6 and its working fine there, but i also want to apply same approach on .Net 4.7.2 , but i am not able to transcribe data. Whisper use IAsyncEnumerable type for its processor and its feature does not have support in c# 7.3/ .Net 4.7.2. So i canged my code but it is not working.

Code working in .Net core 6:

 using var fileStream = File.OpenRead(filePath);
            using var processor = whisperFactory.CreateBuilder().WithLanguage("auto").Build();

           
            await foreach (var result in processor.ProcessAsync(fileStream))
            {
                 translatedResult += $"{result.Start}->{result.End}: {result.Text}";             

            };

This code converted according to .Net 4.7.2 but 'await enumerator.MoveNextAsync()' never come back.

var resultsCollection =  processor.ProcessAsync(fileStream);
                var enumerator = resultsCollection.GetAsyncEnumerator();

                while (await enumerator.MoveNextAsync())
                {
                    var result = enumerator.Current;
                    translatedResult += $"{result.Text}";
                }

I can make api in .Net core6 for transcription purpose but it will slow all process of transcription in real time.

0 Answers0