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("请输入正确的类型!")