0
我试图如图所示here使用spacy如下的API:使用spacy泊坞窗API
安装后测试案例工作得很好:
curl http://localhost:5000/api --header 'content-type: application/json' --data '{"text": "This is a text that I want to be analyzed."}' -X POST
但我要处理的输出与Python,所以我尝试使用请求库:
import requests
url = "http://localhost:5000/api"
payload = {"text" : "This is a text that I want to be analyzed" }
headers = {"content-type": "application/json"}
res = requests.post(url, data=payload, headers=headers)
res.json()
但我发现了一个输出误差:
{u'message': u'The browser (or proxy) sent a request that this server could not understand.'}
我想也是用这个tool的建议:
import requests
data = '{"text": "This is a text that I want to be analyzed."}'
requests.post('http://localhost:5000/api', data=data)
但不工作或者。
您可以添加您用来启动泊坞窗容器的命令以及相应容器的日志吗? –