我正在尝试使用在本地计算机中构建的Grobid,但此脚本打印出500错误。当我使用Curl从CLI执行它时,它工作正常。求救!
0
答案 0 :(得分:0)
这对我有用:
import requests
url = 'http://localhost:8080/api/processHeaderDocument'
multipart_form_data = {
'input': open('file.pdf', 'rb')
}
r = requests.post(url, files=multipart_form_data)
assert response.status_code == 200, response.content
print(response.content)
# extracting xml
from lxml import objectify
root = objectify.fromstring(response.content)
title = root.teiHeader.fileDesc.titleStmt.title