bugfix
This commit is contained in:
parent
ebe895f7fb
commit
29ace2ac85
@ -4,8 +4,25 @@ from ahserver.webapp import webapp
|
||||
from ahserver.filestorage import FileStorage
|
||||
from appPublic.worker import awaitify
|
||||
from appPublic.jsonConfig import getConfig
|
||||
from appPublic.registerfunction import RegisterFunction
|
||||
|
||||
async def align(audio_webpath, text):
|
||||
async def align(request, *params, params_kw={}):
|
||||
audio_webpath = params_kw.audio_path
|
||||
text = params_kw.text
|
||||
if audio_webpath is None:
|
||||
return {
|
||||
"status": "error",
|
||||
"data": {
|
||||
"message": "audio_path is None"
|
||||
}
|
||||
}
|
||||
if text is None:
|
||||
return {
|
||||
"status": "error",
|
||||
"data": {
|
||||
"message": "text is None"
|
||||
}
|
||||
}
|
||||
env = ServerEnv()
|
||||
fs = FileStorage()
|
||||
audio_path = fs.realPath(audio_webpath)
|
||||
@ -30,10 +47,11 @@ async def align(audio_webpath, text):
|
||||
return sentences
|
||||
|
||||
def init():
|
||||
rf = RegisterFunction()
|
||||
rf.register('align', align)
|
||||
env = ServerEnv()
|
||||
config = getConfig()
|
||||
env.align_engine = AlignEngine(config.align_model)
|
||||
env.align = align
|
||||
|
||||
if __name_ == '__main__':
|
||||
webapp(init)
|
||||
|
||||
@ -28,8 +28,8 @@
|
||||
"leading":"/idfile",
|
||||
"registerfunction":"idfile"
|
||||
},{
|
||||
"leading":"/i18n_getmsgs",
|
||||
"registerfunction":"i18n"
|
||||
"leading":"/align",
|
||||
"registerfunction":"align"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user