adr*_*rey 3 python heroku rasa-nlu
我使用 Rasa NLU 和 Rasa Core 制作了一个机器人。它连接到 Node.js 服务器和 React.js 前端。我运行这个 python 脚本的方式是:
var PythonShell = require('python-shell');
var options = {
mode: 'text',
pythonOptions: ['-u'],
scriptPath: './server/Rasa_Bot_Final'
};
var pyshell = new PythonShell('dialogue_management_model.py', options);
app.post('/message', (req, res) => {
pyshell.on('message', function (message) {
// received a message sent from the Python script (a simple "print" statement)
res.end(message)
});
pyshell.send(req.body.messageFromUser);
})
Run Code Online (Sandbox Code Playgroud)
这在我的本地主机上有效,但是,当部署到 heroku 时,我收到此错误:
Error: OSError: [E050] Can't find model 'en'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
Run Code Online (Sandbox Code Playgroud)
这是因为我无法运行:
python -m spacy download en_core_web_md
python -m spacy link en_core_web_md en
Run Code Online (Sandbox Code Playgroud)
在赫罗库上。
有人可以帮我解决这个问题吗?
我引用了这些:https: //spacy.io/usage/
小智 5
确保您在需求中添加了 spacy 以及包含 python 命令的 Procfile。
请参阅:Procfile 文档
在过程文件中:
web: python -m spacy download en_core_web_md && python -m spacy link en_core_web_md en
Run Code Online (Sandbox Code Playgroud)
如果它来自无法运行 python 代码的事实,那么它可能来自无法识别您的代码并相应设置所有内容的测功机。
你应该检查一下,我认为这就是 heroku 所说的buildpack。
| 归档时间: |
|
| 查看次数: |
2195 次 |
| 最近记录: |