有人得到过SpaCy 2.0可以在AWS Lambda中工作吗?我已正确压缩并打包了所有内容,因为如果我对其进行测试,则可以从lambda函数返回通用字符串。但是,当我执行下面的简单功能进行测试时,它停滞了大约10秒钟,然后返回空白,并且没有收到任何错误消息。我确实将Lambda超时设置为60秒,所以这不是问题。
import spacy
nlp = spacy.load('en_core_web_sm') #model package included
def lambda_handler(event, context):
doc = nlp(u'They are')
msg = doc[0].lemma_
return msg
Run Code Online (Sandbox Code Playgroud)
当我加载模型包而不使用它时,它也返回空,但是如果我注释掉它,它会按预期向我发送字符串,因此它必须与加载模型有关。
import spacy
nlp = spacy.load('en_core_web_sm') #model package included
def lambda_handler(event, context):
msg = 'message returned'
return msg
Run Code Online (Sandbox Code Playgroud) 我正在使用 python-cloudant 库,尝试进行查询:
import cloudant
my_database = client['database']
query = cloudant.query.Query(my_database,selector={'selector': {'$gt': 0}},fields=['doi'])
for doc in query(limit=100, skip=100)['docs']:
print doc
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误: HTTPError: 400 Client Error: Bad Request for url: https://myurl.com/mydatabase/_find
当我尝试在浏览器中加载页面时出现此错误:{"error":"method_not_allowed","reason":"Only POST allowed"}
我在这里缺少什么?