mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
wss llm
This commit is contained in:
parent
e97ae7f3f8
commit
f2af56b678
@ -8,7 +8,6 @@ import numpy as np
|
|||||||
import argparse
|
import argparse
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--host", type=str, default="127.0.0.1", required=False, help="host ip, localhost, 0.0.0.0"
|
"--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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
websocket_users = set()
|
websocket_users = set()
|
||||||
|
|
||||||
print("model loading")
|
print("model loading")
|
||||||
@ -84,7 +82,6 @@ model_vad = AutoModel(
|
|||||||
# chunk_size=60,
|
# chunk_size=60,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# async def async_asr(websocket, audio_in):
|
# async def async_asr(websocket, audio_in):
|
||||||
# if len(audio_in) > 0:
|
# if len(audio_in) > 0:
|
||||||
# # print(len(audio_in))
|
# # print(len(audio_in))
|
||||||
@ -229,7 +226,7 @@ async def model_inference(
|
|||||||
)
|
)
|
||||||
contents_i = [{"role": "system", "content": system_prompt}] + contents_i[3:]
|
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(
|
inputs_embeds, contents, batch, source_ids, meta_data = model.inference_prepare(
|
||||||
[contents_i], None, "test_demo", tokenizer, frontend, device=device
|
[contents_i], None, "test_demo", tokenizer, frontend, device=device
|
||||||
@ -263,7 +260,7 @@ async def model_inference(
|
|||||||
"is_final": websocket.is_speaking,
|
"is_final": websocket.is_speaking,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
print(f"online: {message}")
|
# print(f"online: {message}")
|
||||||
await websocket.send(message)
|
await websocket.send(message)
|
||||||
|
|
||||||
mode = "2pass-offline"
|
mode = "2pass-offline"
|
||||||
@ -275,7 +272,7 @@ async def model_inference(
|
|||||||
"is_final": websocket.is_speaking,
|
"is_final": websocket.is_speaking,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
print(f"offline: {message}")
|
# print(f"offline: {message}")
|
||||||
await websocket.send(message)
|
await websocket.send(message)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user