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 509b53ab
authored
Sep 04, 2024
by
‘chizw’
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[+]脚本更新
1 parent
4f6d32a9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
13 deletions
funasr_service.py
utils/ali/test_03_car.py
utils/compfuntine-v1.0.6.py
utils/finetune.py
funasr_service.py
View file @
509b53a
...
@@ -98,11 +98,11 @@ class FunasrService(object):
...
@@ -98,11 +98,11 @@ class FunasrService(object):
batch_size_s
=
300
,
batch_size_s
=
300
,
batch_size_threshold_s
=
60
,
batch_size_threshold_s
=
60
,
hotword
=
"问界 100
\n
质保经理 100
\n
易损易耗件 100
\n
电瓶 100
\n
M5 100
\n
M7 100
\n
M9 100
\n
石子 100"
hotword
=
"问界 100
\n
质保经理 100
\n
易损易耗件 100
\n
电瓶 100
\n
M5 100
\n
M7 100
\n
M9 100
\n
石子 100"
"
\n
橡胶棒 100
\n
电子助力泵 100
\n
电子真空助力泵 100
\n
充电桩 100
\n
密封圈 100
\n
4S店 100
\n
老化 100"
"橡胶棒 100
\n
电子助力泵 100
\n
电子真空助力泵 100
\n
充电桩 100
\n
密封圈 100
\n
4S店 100
\n
老化 100"
"
\n
打死 100
\n
油车 100
\n
电车 100
\n
备忘录 100
\n
自费 100
\n
胶套求成密封圈 100
\n
安信无忧 100"
"打死 100
\n
油车 100
\n
电车 100
\n
备忘录 100
\n
自费 100
\n
胶套求成密封圈 100
\n
安信无忧 100"
"
\n
全车易损耗件 100
\n
厂家 100
\n
喷漆 100
\n
封釉 100
\n
雾化 100
\n
里程 100
\n
延保 100
\n
外地牌 100"
"全车易损耗件 100
\n
厂家 100
\n
喷漆 100
\n
封釉 100
\n
雾化 100
\n
里程 100
\n
延保 100
\n
外地牌 100"
"
\n
轮胎 100
\n
胶条 100
\n
漆面 100
\n
充电接口 100
\n
车衣 100
\n
传动车身 100
\n
喜提新车 100"
"轮胎 100
\n
胶条 100
\n
漆面 100
\n
充电接口 100
\n
车衣 100
\n
传动车身 100
\n
喜提新车 100"
"
\n
估计 100
\n
安心包 100
\n
定损金额 100"
)
"估计 100
\n
安心包 100
\n
定损金额 100"
)
# print(res)
# print(res)
return
res
return
res
...
...
utils/ali/test_03_car.py
View file @
509b53a
...
@@ -182,9 +182,11 @@ credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
...
@@ -182,9 +182,11 @@ credentials = AccessKeyCredential(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'],
client
=
AcsClient
(
region_id
=
'cn-beijing'
,
credential
=
credentials
)
client
=
AcsClient
(
region_id
=
'cn-beijing'
,
credential
=
credentials
)
# fileUrl = 'https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/d15515d1-6ccb-4e58-9ebf-47d45677b298.mp3'
# fileUrl = 'https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/d15515d1-6ccb-4e58-9ebf-47d45677b298.mp3'
base_path
=
"D:/software/python/project/funasr_web/audios/
830
/"
base_path
=
"D:/software/python/project/funasr_web/audios/
0903
/"
txt_path
=
"D:/software/python/project/funasr_web/audios/11111.txt"
txt_path
=
"D:/software/python/project/funasr_web/audios/11111.txt"
with
open
(
txt_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
def
run_file
():
with
open
(
txt_path
,
'r'
,
encoding
=
'utf-8'
)
as
file
:
for
index
,
line
in
enumerate
(
file
,
1
):
for
index
,
line
in
enumerate
(
file
,
1
):
print
(
f
"line==={line}"
)
print
(
f
"line==={line}"
)
parts
=
line
.
strip
()
.
split
(
','
)
parts
=
line
.
strip
()
.
split
(
','
)
...
@@ -195,3 +197,12 @@ with open(txt_path, 'r', encoding='utf-8') as file:
...
@@ -195,3 +197,12 @@ with open(txt_path, 'r', encoding='utf-8') as file:
print
(
'taskId:'
+
taskId
)
print
(
'taskId:'
+
taskId
)
text_list
=
dealTaskResult
(
taskId
)
text_list
=
dealTaskResult
(
taskId
)
write_file
(
text_list
,
f
"{base_path}{name}.txt"
)
write_file
(
text_list
,
f
"{base_path}{name}.txt"
)
def
run_simple
(
fileUrl
,
name
=
None
):
taskId
=
submitTask
(
fileUrl
)
# taskId = 'd80649120bc04d10892f99d70082c194'
print
(
'taskId:'
+
taskId
)
text_list
=
dealTaskResult
(
taskId
)
write_file
(
text_list
,
f
"{base_path}{name}.txt"
)
run_simple
(
"https://glsk-oss.oss-cn-shenzhen.aliyuncs.com/quality/1715688494984merged_17153238831671715320257955.mp3"
,
name
=
"test"
)
\ No newline at end of file
\ No newline at end of file
utils/compfuntine-v1.0.6.py
View file @
509b53a
import
difflib
import
difflib
from
bs4
import
BeautifulSoup
from
bs4
import
BeautifulSoup
def
compare_texts
(
file1_path
,
file2_path
,
output_file_path
):
def
compare_texts
(
file1_path
,
file2_path
,
output_file_path
,
fromdesc
=
'Text 1'
,
todesc
=
'Text 2'
):
print
(
'================================start...==============================='
)
print
(
'================================start...==============================='
)
# 从文件中读取文本内容
# 从文件中读取文本内容
with
open
(
file1_path
,
'r'
,
encoding
=
'utf-8'
)
as
file1
:
with
open
(
file1_path
,
'r'
,
encoding
=
'utf-8'
)
as
file1
:
...
@@ -15,7 +15,7 @@ def compare_texts(file1_path, file2_path, output_file_path):
...
@@ -15,7 +15,7 @@ def compare_texts(file1_path, file2_path, output_file_path):
# 创建HtmlDiff对象来生成HTML格式的差异报告
# 创建HtmlDiff对象来生成HTML格式的差异报告
d
=
difflib
.
HtmlDiff
()
d
=
difflib
.
HtmlDiff
()
diff_html
=
d
.
make_file
(
text1
.
splitlines
(),
text2
.
splitlines
(),
fromdesc
=
'Text 1'
,
todesc
=
'Text 2'
)
diff_html
=
d
.
make_file
(
text1
.
splitlines
(),
text2
.
splitlines
(),
fromdesc
=
fromdesc
,
todesc
=
todesc
)
# 使用BeautifulSoup解析HTML报告
# 使用BeautifulSoup解析HTML报告
soup
=
BeautifulSoup
(
diff_html
,
'html.parser'
)
soup
=
BeautifulSoup
(
diff_html
,
'html.parser'
)
...
@@ -77,7 +77,13 @@ filename = '82874'
...
@@ -77,7 +77,13 @@ filename = '82874'
# output_file_path = f'voicetranseform/compareresult/asresult/{filename}/diff_output_v1.0.6.html'
# output_file_path = f'voicetranseform/compareresult/asresult/{filename}/diff_output_v1.0.6.html'
# compare_texts(file1_path, file2_path, output_file_path)
# compare_texts(file1_path, file2_path, output_file_path)
file1_path
=
f
'C:/Users/chizw/Desktop/新建文本文档.txt'
file1_path
=
f
'D:/software/python/project/funasr_web/audios/leven/correct.txt'
file2_path
=
f
'C:/Users/chizw/Desktop/output.txt'
file2_path
=
f
'D:/software/python/project/funasr_web/audios/leven/origin.txt'
output_file_path
=
f
'C:/Users/chizw/Desktop/diff_output_v1.0.6.source.html'
file3_path
=
f
'D:/software/python/project/funasr_web/audios/leven/output1.txt'
compare_texts
(
file1_path
,
file2_path
,
output_file_path
)
file4_path
=
f
'D:/software/python/project/funasr_web/audios/leven/output2.txt'
file5_path
=
f
'D:/software/python/project/funasr_web/audios/leven/output3.txt'
output_file_path
=
f
'D:/software/python/project/funasr_web/audios/leven/diff_output_v1.0.6.source.html'
compare_texts
(
file1_path
,
file2_path
,
f
'D:/software/python/project/funasr_web/audios/leven/diff/origin.html'
,
fromdesc
=
'标注答案'
,
todesc
=
'初次推理'
)
compare_texts
(
file1_path
,
file3_path
,
f
'D:/software/python/project/funasr_web/audios/leven/diff/output1.html'
,
fromdesc
=
'标注答案'
,
todesc
=
'第一次训练后'
)
compare_texts
(
file1_path
,
file4_path
,
f
'D:/software/python/project/funasr_web/audios/leven/diff/output2.html'
,
fromdesc
=
'标注答案'
,
todesc
=
'第二次训练后'
)
compare_texts
(
file1_path
,
file5_path
,
f
'D:/software/python/project/funasr_web/audios/leven/diff/output3.html'
,
fromdesc
=
'标注答案'
,
todesc
=
'第三次训练后'
)
utils/finetune.py
View file @
509b53a
...
@@ -174,3 +174,9 @@ list = [866,-430,867,870,871,872,873]
...
@@ -174,3 +174,9 @@ list = [866,-430,867,870,871,872,873]
for
id
in
list
:
for
id
in
list
:
# voice_slicing(id)
# voice_slicing(id)
pass
pass
with
open
(
"D:/software/python/project/funasr_web/dataset/temp/train/train_text.txt"
,
'r'
,
encoding
=
'gbk'
)
as
file
:
for
index
,
line
in
enumerate
(
file
,
1
):
parts
=
line
.
split
(
' '
)
name
=
parts
[
0
]
upload_file
(
f
"{index}.wav"
,
f
"D:/software/python/project/funasr_web/dataset/temp/0830_{name}.wav"
)
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