调整ucloud过期时间为5分钟,测试方法添加从ucloud获取的方式

This commit is contained in:
2024-05-29 13:14:13 +08:00
parent 92efea224d
commit 1e917a90dd
2 changed files with 8 additions and 5 deletions

View File

@@ -23,5 +23,5 @@ def get_private_url(key):
# url = get_ufile_handler.public_download_url(bucket, key) # url = get_ufile_handler.public_download_url(bucket, key)
# 获取私有空间下载url, expires为下载链接有效期单位为秒 # 获取私有空间下载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 return url

View File

@@ -6,9 +6,12 @@ from pprint import pprint
from paddlenlp import Taskflow from paddlenlp import Taskflow
from paddlenlp.utils.doc_parser import DocParser 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): def visual_model_test(task_path, test_img, schema):
img = re.split(r'[\\/]', test_img)[-1] img = re.split(r'[\\/]', test_img)[-1]
img = img.split("?")[0]
img_name = "" img_name = ""
img_type = "jpg" img_type = "jpg"
last_dot_index = img.rfind(".") 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) save_path="./img_result/" + img_name + "_my." + img_type)
def main(model_type): def main(model_type, pic_name=None):
# 开始时间 # 开始时间
start_time = time.time() start_time = time.time()
# 结算清单 # 结算清单
if model_type == "settlement": if model_type == "settlement":
task_path = "../../config/model/settlement_list_model" 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 = ["姓名", "入院日期", "出院日期", "费用总额", "个人现金支付", "个人账户支付", "自费", "医保类型"] schema = ["姓名", "入院日期", "出院日期", "费用总额", "个人现金支付", "个人账户支付", "自费", "医保类型"]
elif model_type == "discharge": elif model_type == "discharge":
task_path = "../../config/model/discharge_record_model" 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 = ["医院", "科别", "姓名", "入院日期", "出院日期", "主治医生"] schema = ["医院", "科别", "姓名", "入院日期", "出院日期", "主治医生"]
elif model_type == "cost": elif model_type == "cost":
task_path = "../../config/model/cost_list_model" 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 = ["姓名", "入院日期", "出院日期", "费用总额"] schema = ["姓名", "入院日期", "出院日期", "费用总额"]
else: else:
print("请输入正确的类型!") print("请输入正确的类型!")