This commit is contained in:
zy123 2024-09-25 09:52:04 +08:00
parent 361743a9e1
commit 4d00315636
2 changed files with 11 additions and 12 deletions

View File

@ -78,21 +78,20 @@ def create_logger():
# 流式
@app.route('/upload', methods=['POST'])
def zbparse():
logger = g.logger
logger.info("start!!!")
# 获取并显示接收到的 JSON 数据
received_data = request.get_json()
logger.info("Received JSON data: " + str(received_data))
# file_url = validate_request()
# if isinstance(file_url, tuple): # Check if the returned value is an error response
# return file_url
# try:
# logger.info("starting parsing url:" + file_url)
# return Response(stream_with_context(process_and_stream(file_url)), content_type='text/event-stream')
# except Exception as e:
# logger.error('Exception occurred: ' + str(e))
# return jsonify({'error': str(e)}), 500
file_url = validate_request()
if isinstance(file_url, tuple): # Check if the returned value is an error response
return file_url
try:
logger.info("starting parsing url:" + file_url)
return Response(stream_with_context(process_and_stream(file_url)), content_type='text/event-stream')
except Exception as e:
logger.error('Exception occurred: ' + str(e))
return jsonify({'error': str(e)}), 500
# 分段返回

View File

@ -32,9 +32,9 @@ if __name__ == "__main__":
input_file="C:\\Users\\Administrator\\Desktop\\fsdownload\\4a611a66-0dac-4daf-b365-c6167c5b8c8d\\ztbfile.pdf"
output_folder = "C:\\Users\\Administrator\\Desktop\\fsdownload\\4a611a66-0dac-4daf-b365-c6167c5b8c8d"
# truncate0 = os.path.join(output_folder, "zbtest20_tobidders_notice_table.pdf")
truncate2=os.path.join(output_folder,"ztbfile_qualification.pdf")
truncate2=os.path.join(output_folder,"ztbfile_tobidders_notice.pdf")
knowledge_name="zbtest20"
truncate1=os.path.join(output_folder,"ztbfile_qualification.pdf")
truncate1=os.path.join(output_folder,"ztbfile_evaluation_method.pdf")
truncate3=os.path.join(output_folder,"ztbfile_qualification.pdf")
clause_path = convert_clause_to_json(truncate2, output_folder)
truncate0_jsonpath = os.path.join(output_folder, "truncate_output.json")