public ucAsrClient(AsrClient asrClient) { InitializeComponent(); panel2.Enabled = false; _client = asrClient; }
public ucMt(AsrClient client) { InitializeComponent(); _client = client; cmbTo.SelectedIndex = 0; }
static void Main(string[] args) { var client = new AsrClient("127.0.0.1:8050", "1906"); client.LogLevel = 0; Console.WriteLine("Create client"); AsrClientDemo demo = new AsrClientDemo(); var stream0 = client.NewStream(new StreamToken("fakeuser", new DateTime(2019, 4, 25, 12, 41, 16), "fakepassword")); var task0 = demo.FileAsrAsync(stream0, "C:\\Users\\temp.wav", client.RecommendPacketSize); var stream1 = client.NewStream(new StreamToken("fakeuser", new DateTime(2021, 1, 1), "fakepassword")); var task1 = demo.FileAsrAsync(stream1, "C:\\Users\\zhiyu2.wav", client.RecommendPacketSize); task0.Wait(); task1.Wait(); Console.ReadLine(); }
static void Main(string[] args) { var client = new AsrClient("asr.baiduai.cloud:8051", "1906"); client.LogLevel = 0; Console.WriteLine("Create client"); AsrClientDemo demo = new AsrClientDemo(); var stream0 = client.NewStream(new StreamToken("fake_user", new DateTime(2021, 4, 25, 12, 41, 16), "fake_password")); var task0 = demo.FileAsrAsync(stream0, "C:\\GitHub\\pie\\zhiyu1.wav", client.RecommendPacketSize); var stream1 = client.NewStream(new StreamToken("fake_user", new DateTime(2021, 1, 1), "fake_password")); var task1 = demo.FileAsrAsync(stream1, "C:\\GitHub\\pie\\zhiyu2.wav", client.RecommendPacketSize); task0.Wait(); task1.Wait(); Console.ReadLine(); }
private void RunDiscernAsPath(string path, string type) { Task.Factory.StartNew(async() => { AsrClient asrClient = new AsrClient("3a1ec26757b94a84af648ac1f88cb95f"); asrClient.ReturnPartialResult += (s) => //部份识别完成 { this.Invoke(new Action(() => { this.rtBoxResult.Text = s; })); }; asrClient.ReturnRecognitionResult += (s) => //全部识别完成 { this.Invoke(new Action(() => { this.rtBoxResult.Text = s; })); }; await asrClient.RunDiscernAsPath(path, type); }); }
private void RunDiscernAsPath(string path, string type) { Task.Factory.StartNew(async() => { AsrClient asrClient = new AsrClient("0549ec95cfb14f9f911562949117c4e3"); asrClient.ReturnPartialResult += (s) => //部份识别完成 { this.Invoke(new Action(() => { this.rtBoxResult.Text = s; })); }; asrClient.ReturnRecognitionResult += (s) => //全部识别完成 { this.Invoke(new Action(() => { this.rtBoxResult.Text = s; })); }; await asrClient.RunDiscernAsPath(path, type); }); }
public Form1() { InitializeComponent(); // 实例化客户端 _client = new AsrClient("127.0.0.1", 8888); _client.OnInitialized += _asr_OnConnected; asr = new ucAsrClient(_client) { Dock = DockStyle.Fill }; tabPage1.Controls.Add(asr); mt = new ucMt(_client) { Dock = DockStyle.Fill }; tabPage2.Controls.Add(mt); // 建立连接 _client.ConnectAsync(); }