添加文本信息抽取接口
This commit is contained in:
@@ -22,6 +22,13 @@ def main():
|
||||
return COST({'doc': img_path, 'layout': json.loads(layout)})
|
||||
|
||||
|
||||
@app.route('/text', methods=['POST'])
|
||||
@process_request
|
||||
def text():
|
||||
t = request.form.get('text')
|
||||
return COST(t)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.config.dictConfig(LOGGING_CONFIG)
|
||||
app.run('0.0.0.0', 5004)
|
||||
|
||||
@@ -24,6 +24,13 @@ def main():
|
||||
return DISCHARGE({'doc': img_path, 'layout': json.loads(layout)})
|
||||
|
||||
|
||||
@app.route('/text', methods=['POST'])
|
||||
@process_request
|
||||
def text():
|
||||
t = request.form.get('text')
|
||||
return DISCHARGE(t)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.config.dictConfig(LOGGING_CONFIG)
|
||||
app.run('0.0.0.0', 5003)
|
||||
|
||||
@@ -28,6 +28,13 @@ def main():
|
||||
return SETTLEMENT_IE({'doc': img_path, 'layout': json.loads(layout)})
|
||||
|
||||
|
||||
@app.route('/text', methods=['POST'])
|
||||
@process_request
|
||||
def text():
|
||||
t = request.form.get('text')
|
||||
return SETTLEMENT_IE(t)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
logging.config.dictConfig(LOGGING_CONFIG)
|
||||
app.run('0.0.0.0', 5002)
|
||||
|
||||
@@ -38,6 +38,22 @@ def ie_settlement(img_path, layout):
|
||||
return None
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_random(1, 3), reraise=True,
|
||||
after=lambda x: logging.warning('从文本抽取基本医保结算单失败!'))
|
||||
def ie_settlement(text):
|
||||
"""
|
||||
请求基本医保结算单信息抽取接口
|
||||
:param text: 待抽取文本
|
||||
:return: 抽取结果
|
||||
"""
|
||||
url = 'http://ie_settlement:5002/text'
|
||||
response = requests.post(url, {'text': text})
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_random(1, 3), reraise=True,
|
||||
after=lambda x: logging.warning('抽取出院记录失败!'))
|
||||
def ie_discharge(img_path, layout):
|
||||
@@ -55,6 +71,22 @@ def ie_discharge(img_path, layout):
|
||||
return None
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_random(1, 3), reraise=True,
|
||||
after=lambda x: logging.warning('从文本抽取出院记录失败!'))
|
||||
def ie_discharge(text):
|
||||
"""
|
||||
请求出院记录信息抽取接口
|
||||
:param text: 待抽取文本
|
||||
:return: 抽取结果
|
||||
"""
|
||||
url = 'http://ie_discharge:5003/text'
|
||||
response = requests.post(url, {'text': text})
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_random(1, 3), reraise=True,
|
||||
after=lambda x: logging.warning('抽取费用清单失败!'))
|
||||
def ie_cost(img_path, layout):
|
||||
@@ -72,6 +104,22 @@ def ie_cost(img_path, layout):
|
||||
return None
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_random(1, 3), reraise=True,
|
||||
after=lambda x: logging.warning('从文本抽取费用清单失败!'))
|
||||
def ie_cost(text):
|
||||
"""
|
||||
请求费用清单信息抽取接口
|
||||
:param text: 待抽取文本
|
||||
:return: 抽取结果
|
||||
"""
|
||||
url = 'http://ie_cost:5004/text'
|
||||
response = requests.post(url, {'text': text})
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
@retry(stop=stop_after_attempt(3), wait=wait_random(1, 3), reraise=True,
|
||||
after=lambda x: logging.warning('获取图片方向失败!'))
|
||||
def clas_orientation(img_path):
|
||||
|
||||
Reference in New Issue
Block a user