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 c4e0293f
authored
Dec 17, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]sql优化
1 parent
1a9841ca
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
funasr_service.py
mysql_service/funasr_db.py
funasr_service.py
View file @
c4e0293
...
@@ -231,10 +231,12 @@ def merge_spk_transform_output(sentence_info):
...
@@ -231,10 +231,12 @@ def merge_spk_transform_output(sentence_info):
json_output
=
json
.
dumps
(
output
,
ensure_ascii
=
False
)
json_output
=
json
.
dumps
(
output
,
ensure_ascii
=
False
)
return
json_output
return
json_output
def
add_milliseconds_to_time
(
dt
,
milliseconds
):
def
add_milliseconds_to_time
(
dt
,
milliseconds
):
"""将毫秒数添加到datetime对象上"""
"""将毫秒数添加到datetime对象上"""
return
dt
+
datetime
.
timedelta
(
milliseconds
=
milliseconds
)
return
dt
+
datetime
.
timedelta
(
milliseconds
=
milliseconds
)
def
test_comparison_transform_output
(
sentence_info
):
def
test_comparison_transform_output
(
sentence_info
):
initial_time
=
datetime
.
datetime
(
1
,
1
,
1
,
0
,
0
,
0
,
0
)
initial_time
=
datetime
.
datetime
(
1
,
1
,
1
,
0
,
0
,
0
,
0
)
output
=
[]
output
=
[]
...
@@ -246,6 +248,7 @@ def test_comparison_transform_output(sentence_info):
...
@@ -246,6 +248,7 @@ def test_comparison_transform_output(sentence_info):
print
(
f
"[{time}] {spk}:{text}"
)
print
(
f
"[{time}] {spk}:{text}"
)
return
output
return
output
def
task_compensate_send
():
def
task_compensate_send
():
try
:
try
:
log
.
info
(
"task_compensate_send start"
)
log
.
info
(
"task_compensate_send start"
)
...
@@ -253,6 +256,8 @@ def task_compensate_send():
...
@@ -253,6 +256,8 @@ def task_compensate_send():
if
res
is
not
None
and
len
(
res
)
>
0
:
if
res
is
not
None
and
len
(
res
)
>
0
:
for
item
in
res
:
for
item
in
res
:
funasr_producer
.
send_task_id
(
item
[
"task_id"
])
funasr_producer
.
send_task_id
(
item
[
"task_id"
])
else
:
funasr_producer
.
send_wait_task
()
log
.
info
(
"task_compensate_send end"
)
log
.
info
(
"task_compensate_send end"
)
except
Exception
as
e
:
except
Exception
as
e
:
log
.
error
(
"task_compensate_send error"
,
e
)
log
.
error
(
"task_compensate_send error"
,
e
)
...
@@ -279,6 +284,7 @@ def adjust_time_with_milliseconds(offset_milliseconds, duration_milliseconds):
...
@@ -279,6 +284,7 @@ def adjust_time_with_milliseconds(offset_milliseconds, duration_milliseconds):
formatted_end_time
=
end_time
.
strftime
(
'
%
M:
%
S'
)
formatted_end_time
=
end_time
.
strftime
(
'
%
M:
%
S'
)
return
formatted_start_time
,
formatted_end_time
return
formatted_start_time
,
formatted_end_time
def
careful_transform_output
(
output_data
):
def
careful_transform_output
(
output_data
):
json_output
=
json
.
loads
(
output_data
)
json_output
=
json
.
loads
(
output_data
)
for
item
in
json_output
:
for
item
in
json_output
:
...
...
mysql_service/funasr_db.py
View file @
c4e0293
...
@@ -54,7 +54,9 @@ def select_ali_asr_model_res(task_id: str):
...
@@ -54,7 +54,9 @@ def select_ali_asr_model_res(task_id: str):
"select id,task_id,file_url,task_status,output_data,exception_msg"
"select id,task_id,file_url,task_status,output_data,exception_msg"
" from ali_asr_model_res aamr"
" from ali_asr_model_res aamr"
" where del_flag = 0 and "
" where del_flag = 0 and "
"task_id =
%
s and exception_limit < 3;"
)
"task_id =
%
s and exception_limit < 3;"
"order by created_time desc"
)
return
pool
.
select_all
(
select_sql
,
(
task_id
,))
return
pool
.
select_all
(
select_sql
,
(
task_id
,))
...
...
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