Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
funasr_web
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b8f3d428
authored
Mar 21, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]多进程优化
1 parent
e23e0ff8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletions
funasr_service.py
funasr_service.py
View file @
b8f3d42
import
multiprocessing
import
threading
import
time
from
funasr
import
AutoModel
from
log.logger
import
log
...
...
@@ -64,6 +65,8 @@ class model_output():
def
handle_process
(
message
:
str
):
try
:
log
.
info
(
f
"""handle_process process name:{multiprocessing.current_process()},thread name:{threading.current_thread().name},
Received task_id: {message}"""
)
# 处理逻辑
start_time
=
time
.
time
()
task_id
=
json
.
loads
(
message
)[
"task_id"
]
...
...
@@ -71,7 +74,7 @@ def handle_process(message: str):
log
.
info
(
"funasr_handle_process耗时:"
+
str
(
time
.
time
()
-
start_time
))
except
Exception
as
e
:
traceback
.
print_exc
()
log
.
error
(
"funasr
consumer
Exception: "
+
str
(
e
))
log
.
error
(
"funasr
handle_process
Exception: "
+
str
(
e
))
def
deal_worker
(
task_id
:
str
):
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment