提交 354601d0 编写于 作者: 小湉湉's avatar 小湉湉

fix readme, test=doc

上级 dfb09eee
此差异已折叠。
此差异已折叠。
...@@ -550,11 +550,9 @@ class CLSClientExecutor(BaseExecutor): ...@@ -550,11 +550,9 @@ class CLSClientExecutor(BaseExecutor):
""" """
Python API to call an executor. Python API to call an executor.
""" """
url = 'http://' + server_ip + ":" + str(port) + '/paddlespeech/cls' url = 'http://' + server_ip + ":" + str(port) + '/paddlespeech/cls'
audio = wav2base64(input) audio = wav2base64(input)
data = {"audio": audio, "topk": topk} data = {"audio": audio, "topk": topk}
res = requests.post(url=url, data=json.dumps(data)) res = requests.post(url=url, data=json.dumps(data))
return res return res
...@@ -679,6 +677,7 @@ class VectorClientExecutor(BaseExecutor): ...@@ -679,6 +677,7 @@ class VectorClientExecutor(BaseExecutor):
test_audio=args.test, test_audio=args.test,
task=task) task=task)
time_end = time.time() time_end = time.time()
logger.info(res.json())
logger.info("Response time %f s." % (time_end - time_start)) logger.info("Response time %f s." % (time_end - time_start))
return True return True
except Exception as e: except Exception as e:
...@@ -718,7 +717,6 @@ class VectorClientExecutor(BaseExecutor): ...@@ -718,7 +717,6 @@ class VectorClientExecutor(BaseExecutor):
logger.info(f"the input audio: {input}") logger.info(f"the input audio: {input}")
handler = VectorHttpHandler(server_ip=server_ip, port=port) handler = VectorHttpHandler(server_ip=server_ip, port=port)
res = handler.run(input, audio_format, sample_rate) res = handler.run(input, audio_format, sample_rate)
logger.info(f"The spk embedding is: {res}")
return res return res
elif task == "score": elif task == "score":
from paddlespeech.server.utils.audio_handler import VectorScoreHttpHandler from paddlespeech.server.utils.audio_handler import VectorScoreHttpHandler
...@@ -728,7 +726,6 @@ class VectorClientExecutor(BaseExecutor): ...@@ -728,7 +726,6 @@ class VectorClientExecutor(BaseExecutor):
handler = VectorScoreHttpHandler(server_ip=server_ip, port=port) handler = VectorScoreHttpHandler(server_ip=server_ip, port=port)
res = handler.run(enroll_audio, test_audio, audio_format, res = handler.run(enroll_audio, test_audio, audio_format,
sample_rate) sample_rate)
logger.info(f"The vector score is: {res}")
return res return res
else: else:
logger.error(f"Sorry, we have not support such task {task}") logger.error(f"Sorry, we have not support such task {task}")
......
...@@ -554,7 +554,7 @@ class VectorHttpHandler: ...@@ -554,7 +554,7 @@ class VectorHttpHandler:
res = requests.post(url=self.url, data=json.dumps(data)) res = requests.post(url=self.url, data=json.dumps(data))
return res.json() return res
class VectorScoreHttpHandler: class VectorScoreHttpHandler:
...@@ -602,4 +602,4 @@ class VectorScoreHttpHandler: ...@@ -602,4 +602,4 @@ class VectorScoreHttpHandler:
res = requests.post(url=self.url, data=json.dumps(data)) res = requests.post(url=self.url, data=json.dumps(data))
return res.json() return res
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册