From 1de67a6647e598ce59e65eb87205e45643e0a2f9 Mon Sep 17 00:00:00 2001 From: nl8590687 <3210346136@qq.com> Date: Wed, 25 Apr 2018 21:55:34 +0800 Subject: [PATCH] modify asrserver --- .gitignore | 4 +++- asrserver.py | 37 +++++++++++++++++++++++++------------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 62e9622..2dcda11 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,6 @@ [Mm]odel_language/ __pycache__ *.wav -Test_Report_* \ No newline at end of file +Test_Report_* + +testClient.py \ No newline at end of file diff --git a/asrserver.py b/asrserver.py index eb3b2a4..c8dfc17 100644 --- a/asrserver.py +++ b/asrserver.py @@ -47,15 +47,20 @@ class TestHTTPHandle(http.server.BaseHTTPRequestHandler): for line in datas_split: [key, value]=line.split('=') - if('wavs' = key): + if('wavs' == key): wavs.append(int(value)) elif('fs' == key): fs = value elif('token' == key ): token = value + else: + print(key, value) - if(token == 'asd'): - buf = '成功\n'+'wavs:\n'+str(wavs)+'\nfs:\n'+str(fs) + r = self.recognize(wavs) + + if(token == 'qwertasd'): + #buf = '成功\n'+'wavs:\n'+str(wavs)+'\nfs:\n'+str(fs) + buf = r else: buf = '403' @@ -63,20 +68,28 @@ class TestHTTPHandle(http.server.BaseHTTPRequestHandler): self._set_response() - ''' - datapath = 'data/' - modelpath = 'model_speech' - ms = ModelSpeech(datapath) - ms.LoadModel(modelpath + 'speech_model22_e_0_step_37000.model') - wav_filename = '' - r_speech = ms.RecognizeSpeech_FromFile(wav_filename) - ''' + + + #buf = ' \n \n
\n