From 1e917a90dd6263ab390c2da85f5c4dffd9e9f94d Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Wed, 29 May 2024 13:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4ucloud=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=B8=BA5=E5=88=86=E9=92=9F=EF=BC=8C?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=96=B9=E6=B3=95=E6=B7=BB=E5=8A=A0=E4=BB=8E?= =?UTF-8?q?ucloud=E8=8E=B7=E5=8F=96=E7=9A=84=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- photo_review/util/ucloud.py | 2 +- test/visual_model_test/visual_model_test.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/photo_review/util/ucloud.py b/photo_review/util/ucloud.py index b95120b..53d3420 100644 --- a/photo_review/util/ucloud.py +++ b/photo_review/util/ucloud.py @@ -23,5 +23,5 @@ def get_private_url(key): # url = get_ufile_handler.public_download_url(bucket, key) # 获取私有空间下载url, expires为下载链接有效期,单位为秒 - url = get_ufile_handler.private_download_url(bucket, key, expires=60) + url = get_ufile_handler.private_download_url(bucket, key, expires=300) return url diff --git a/test/visual_model_test/visual_model_test.py b/test/visual_model_test/visual_model_test.py index 1104f22..91aaabc 100644 --- a/test/visual_model_test/visual_model_test.py +++ b/test/visual_model_test/visual_model_test.py @@ -6,9 +6,12 @@ from pprint import pprint from paddlenlp import Taskflow from paddlenlp.utils.doc_parser import DocParser +from photo_review.util.ucloud import get_private_url + def visual_model_test(task_path, test_img, schema): img = re.split(r'[\\/]', test_img)[-1] + img = img.split("?")[0] img_name = "" img_type = "jpg" last_dot_index = img.rfind(".") @@ -34,22 +37,22 @@ def visual_model_test(task_path, test_img, schema): save_path="./img_result/" + img_name + "_my." + img_type) -def main(model_type): +def main(model_type, pic_name=None): # 开始时间 start_time = time.time() # 结算清单 if model_type == "settlement": task_path = "../../config/model/settlement_list_model" - test_img_path = "img/PH20240511000638_1_094306_1.jpg" + test_img_path = get_private_url(pic_name) if pic_name else "img/PH20240511000638_1_094306_1.jpg" schema = ["姓名", "入院日期", "出院日期", "费用总额", "个人现金支付", "个人账户支付", "自费", "医保类型"] elif model_type == "discharge": task_path = "../../config/model/discharge_record_model" - test_img_path = "img/PH20240401000003_3_001938_2.jpg" + test_img_path = get_private_url(pic_name) if pic_name else "img/PH20240401000003_3_001938_2.jpg" schema = ["医院", "科别", "姓名", "入院日期", "出院日期", "主治医生"] elif model_type == "cost": task_path = "../../config/model/cost_list_model" - test_img_path = "img/PH20240511000648_4_094542_2.jpg" + test_img_path = get_private_url(pic_name) if pic_name else "img/PH20240511000648_4_094542_2.jpg" schema = ["姓名", "入院日期", "出院日期", "费用总额"] else: print("请输入正确的类型!")