This commit is contained in:
游雁 2024-08-26 15:00:41 +08:00
parent e97ae7f3f8
commit f2af56b678

View File

@ -8,7 +8,6 @@ import numpy as np
import argparse
import ssl
parser = argparse.ArgumentParser()
parser.add_argument(
"--host", type=str, default="127.0.0.1", required=False, help="host ip, localhost, 0.0.0.0"
@ -55,7 +54,6 @@ parser.add_argument(
)
args = parser.parse_args()
websocket_users = set()
print("model loading")
@ -84,7 +82,6 @@ model_vad = AutoModel(
# chunk_size=60,
)
# async def async_asr(websocket, audio_in):
# if len(audio_in) > 0:
# # print(len(audio_in))
@ -229,7 +226,7 @@ async def model_inference(
)
contents_i = [{"role": "system", "content": system_prompt}] + contents_i[3:]
print(f"contents_i: {contents_i}")
# print(f"contents_i: {contents_i}")
inputs_embeds, contents, batch, source_ids, meta_data = model.inference_prepare(
[contents_i], None, "test_demo", tokenizer, frontend, device=device
@ -263,7 +260,7 @@ async def model_inference(
"is_final": websocket.is_speaking,
}
)
print(f"online: {message}")
# print(f"online: {message}")
await websocket.send(message)
mode = "2pass-offline"
@ -275,7 +272,7 @@ async def model_inference(
"is_final": websocket.is_speaking,
}
)
print(f"offline: {message}")
# print(f"offline: {message}")
await websocket.send(message)