无法在安卓版的 kivy 上导入深度语音



我正在使用kivy创建一个android应用程序。我需要安装深度语音框架,然而,为了安装深度语音,有必要创建一个配方。我创建了一个配方并构建了apk,构建中没有错误,它创建了apk。据我在文件夹中所见,深度语音已经构建完成。然而,当我在手机中安装该应用程序并尝试运行该应用程序后,它崩溃了,并表示没有名为deeptspeech的模块。有人知道我做错了什么吗?我已经被这个问题困扰了一段时间,似乎找不到这个问题的结束:/。

from pythonforandroid.recipe import PythonRecipe
from pythonforandroid.toolchain import current_directory, shprint
import sh

class deepspeechRecipe(PythonRecipe):
version = 'v0.9.2'
url = 'https://github.com/mozilla/DeepSpeech/archive/{version}.tar.gz'
depends = ['numpy', 'setuptools']
call_hostpython_via_targetpython = False
site_packages_name = 'deepspeech'
def build_arch(self, arch):
env = self.get_recipe_env(arch)
with current_directory(self.get_build_dir(arch.arch)):
# Build python bindings
hostpython = sh.Command(self.hostpython_location)
shprint(hostpython,
'setup.py',
'build_ext', _env=env)
# Install python bindings
super().build_arch(arch)
def get_recipe_env(self, arch):
env = super().get_recipe_env(arch)
numpy_recipe = self.get_recipe('numpy', self.ctx)
env['CFLAGS'] += ' -I' + numpy_recipe.get_build_dir(arch.arch)
#env['LDFLAGS'] += ' -L' + sqlite_recipe.get_lib_dir(arch)
env['LIBS'] = env.get('LIBS', '') + ' -lnumpy'
return env

recipe = deepspeechRecipe()

Buildozer:1.4.0

requirements=python3==3.7.14,hostpython3==3.7.14,kivy,kivymd,sqlite3,numpy==1.14.5,深度语音,apsw-

如果你需要任何额外的信息,我可以补充。

我已经尝试过使用tensorflow来运行该模型,但是,该模型给出了一个数组作为输出,我不知道将其转换为文本形式的正确过程。我已经尝试过其他食谱(比如opencv(,而且都很好。

编辑:我发现,当我使用这个配方时,它确实会运行,而且它确实会正确构建,但只有deepspeech_training部分,因为setup.py只安装它。为了安装类似模型类的其他部分,需要使用位于"中的另一个setup.py;native_client/python";,但这需要其余的文件夹,所以我仍然需要弄清楚。

第2版:我能够构建我想要的包(深度语音的推断(,但当我运行它时,会出现以下错误。

python:ImportError:dlopen失败:库"libc++共享.so";找不到:命名空间classloader命名空间中的/data/user/0/org.test.myapp/files/app/python_bundle/site-packages/deepspeech/impl.so需要python:android的python结束了。

在您的需求中添加枕头,并检查它是否有效!

requirements=python3==3.7.14,hostpython3==3.7.14、kivy、kivymd、sqlite3、numpy==1.14.5、deeptspeech、apsw、pillow

最新更新