23 lines
915 B
Python
23 lines
915 B
Python
|
# pip install alibabacloud_ocr_api20210707==3.1.3
|
|||
|
# pip install alibabacloud_credentials
|
|||
|
from Config.Config import ALY_OSS_PREFIX
|
|||
|
from Util import LlmUtil, OcrUtil
|
|||
|
from Util import OssUtil
|
|||
|
|
|||
|
if __name__ == '__main__':
|
|||
|
# 上传图片
|
|||
|
local_file = "glth.jpg"
|
|||
|
# 获取文件名
|
|||
|
local_file = local_file.replace("\\", "/")
|
|||
|
file_name = local_file.split("/")[-1]
|
|||
|
# 上传文件
|
|||
|
OssUtil.upload_to_oss(local_file, ALY_OSS_PREFIX + "/" + file_name)
|
|||
|
# 获取远程下载地址
|
|||
|
image_url = OssUtil.get_url(file_name)
|
|||
|
# OCR识别手写体
|
|||
|
content = OcrUtil.recognize_handwriting(image_url)
|
|||
|
# 输出识别内容,发现空格就换行输出
|
|||
|
query_text = f'我将提供一篇三年级学生作文,请点评学生作文,并打分,满分30分。下面是作文内容:{content}'
|
|||
|
response = LlmUtil.get_llm_response(query_text)
|
|||
|
print(response)
|