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 f0cd387e
authored
Mar 21, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]url参数校验
1 parent
f4db36c0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
funasr_service.py
main.py
funasr_service.py
View file @
f0cd387
...
@@ -84,6 +84,8 @@ def deal_worker(task_id: str):
...
@@ -84,6 +84,8 @@ def deal_worker(task_id: str):
if
output_data
is
not
None
:
if
output_data
is
not
None
:
return
return
url
=
sql_res
[
0
][
"file_url"
]
url
=
sql_res
[
0
][
"file_url"
]
if
url
==
""
or
len
(
url
)
<
1
or
not
url
.
startswith
(
"http"
):
return
log
.
info
(
f
"Worker {task_id} is running... url:{url}"
)
log
.
info
(
f
"Worker {task_id} is running... url:{url}"
)
consuming_start_time
=
time
.
perf_counter
()
consuming_start_time
=
time
.
perf_counter
()
# 解析音频
# 解析音频
...
...
main.py
View file @
f0cd387
...
@@ -183,8 +183,21 @@ class UrlParam(BaseModel):
...
@@ -183,8 +183,21 @@ class UrlParam(BaseModel):
async
def
create_url
(
param
:
UrlParam
):
async
def
create_url
(
param
:
UrlParam
):
try
:
try
:
log
.
info
(
f
"funasr create_url api param:{param}"
)
log
.
info
(
f
"funasr create_url api param:{param}"
)
task_id
=
str
(
uuid
.
uuid1
())
url
=
param
.
url
url
=
param
.
url
if
url
is
None
:
return
BaseResponse
(
code
=-
1
,
msg
=
"error"
,
data
=
"url is empty"
)
url
.
replace
(
" "
,
""
)
if
url
==
""
or
len
(
url
)
<
1
or
not
url
.
startswith
(
"http"
):
return
BaseResponse
(
code
=-
1
,
msg
=
"error"
,
data
=
"url format error"
)
task_id
=
str
(
uuid
.
uuid1
())
res
=
funasr_db
.
insert_ali_asr_model_res
(
task_id
,
url
)
res
=
funasr_db
.
insert_ali_asr_model_res
(
task_id
,
url
)
if
res
is
None
or
(
isinstance
(
res
,
bool
)
and
res
is
False
):
if
res
is
None
or
(
isinstance
(
res
,
bool
)
and
res
is
False
):
return
BaseResponse
(
return
BaseResponse
(
...
@@ -223,7 +236,7 @@ def start_process():
...
@@ -223,7 +236,7 @@ def start_process():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
log
.
info
(
"funasr main starting..."
)
log
.
info
(
"funasr main starting..."
)
start_
kafka
()
start_
process
()
funasr_producer
.
send_wait_task
()
funasr_producer
.
send_wait_task
()
save_path
=
"./audio/"
save_path
=
"./audio/"
if
os
.
path
.
exists
(
save_path
):
if
os
.
path
.
exists
(
save_path
):
...
...
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