2.19 判断是否招标文件
This commit is contained in:
parent
0595a87efa
commit
9435178b0e
@ -36,7 +36,7 @@ def judge_zbfile() -> Any: #判断是否是招标文件
|
||||
# )
|
||||
result = pool.apply(
|
||||
judge_zbfile_exec, # 你的实际执行函数
|
||||
args=(file_path,)
|
||||
args=(file_path,logger,)
|
||||
)
|
||||
return result
|
||||
def wrapper() -> None:
|
||||
|
@ -4,7 +4,7 @@ from docx import Document
|
||||
import fitz
|
||||
from flask_app.general.llm.通义千问long import upload_file, qianwen_long
|
||||
|
||||
def judge_zbfile_exec(file_path):
|
||||
def judge_zbfile_exec(file_path,logger):
|
||||
"""
|
||||
判断文件是否属于招标文件,并返回结果。
|
||||
"""
|
||||
@ -45,7 +45,7 @@ def judge_zbfile_exec(file_path):
|
||||
print("DOCX 文件读取失败,可能为乱码文件")
|
||||
return False # 解析失败直接返回 False
|
||||
pre_endtime=time.time()
|
||||
print(f"judge_zbfile_exec预处理耗时:{pre_endtime - start_time:.2f} 秒")
|
||||
logger.info(f"judge_zbfile_exec预处理耗时:{pre_endtime - start_time:.2f} 秒")
|
||||
# 使用大模型进行判断
|
||||
user_query = """该文件是否属于招标文件?如果是的话,请返回'是',如果不是的话,返回'否'。请不要返回其他解释或内容。
|
||||
以下是常见的招标文件类型:
|
||||
@ -59,8 +59,8 @@ def judge_zbfile_exec(file_path):
|
||||
file_id = upload_file(file_path)
|
||||
model_res = qianwen_long(file_id, user_query)
|
||||
end_time = time.time()
|
||||
print(f"judge_zbfile_exec实际耗时:{end_time - start_time:.2f} 秒")
|
||||
print(f"判断是否属于招标文件:{model_res}")
|
||||
logger.info(f"judge_zbfile_exec实际耗时:{end_time - start_time:.2f} 秒")
|
||||
print(f"判断是否属于招标文件:{model_res} 实际耗时:{end_time - start_time:.2f} 秒")
|
||||
|
||||
return '否' not in model_res
|
||||
|
||||
|
@ -20,5 +20,5 @@ def warmup_request():
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = create_app()
|
||||
# threading.Thread(target=warmup_request, daemon=True).start()
|
||||
threading.Thread(target=warmup_request, daemon=True).start()
|
||||
serve(app, host='0.0.0.0', port=5000)
|
@ -16,7 +16,7 @@ from flask_app.routes.test_preprocess import test_process_bp
|
||||
def create_app():
|
||||
# 创建全局日志记录器
|
||||
app = Flask(__name__)
|
||||
app.process_pool = Pool(processes=5, maxtasksperchild=1)
|
||||
app.process_pool = Pool(processes=3, maxtasksperchild=1)
|
||||
app.global_logger = create_logger_main('model_log') # 全局日志记录器
|
||||
# 注册蓝图
|
||||
app.register_blueprint(get_deviation_bp)
|
||||
|
Loading…
x
Reference in New Issue
Block a user