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 ahserver.filestorage import FileStorage
|
||||||
from appPublic.worker import awaitify
|
from appPublic.worker import awaitify
|
||||||
from appPublic.jsonConfig import getConfig
|
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()
|
env = ServerEnv()
|
||||||
fs = FileStorage()
|
fs = FileStorage()
|
||||||
audio_path = fs.realPath(audio_webpath)
|
audio_path = fs.realPath(audio_webpath)
|
||||||
@ -30,10 +47,11 @@ async def align(audio_webpath, text):
|
|||||||
return sentences
|
return sentences
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
|
rf = RegisterFunction()
|
||||||
|
rf.register('align', align)
|
||||||
env = ServerEnv()
|
env = ServerEnv()
|
||||||
config = getConfig()
|
config = getConfig()
|
||||||
env.align_engine = AlignEngine(config.align_model)
|
env.align_engine = AlignEngine(config.align_model)
|
||||||
env.align = align
|
|
||||||
|
|
||||||
if __name_ == '__main__':
|
if __name_ == '__main__':
|
||||||
webapp(init)
|
webapp(init)
|
||||||
|
|||||||
@ -28,8 +28,8 @@
|
|||||||
"leading":"/idfile",
|
"leading":"/idfile",
|
||||||
"registerfunction":"idfile"
|
"registerfunction":"idfile"
|
||||||
},{
|
},{
|
||||||
"leading":"/i18n_getmsgs",
|
"leading":"/align",
|
||||||
"registerfunction":"i18n"
|
"registerfunction":"align"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user