Files
dsProject/dsLightRag/Dsideal/ZuoWen/ZuoWenEnglish.py
2025-08-14 15:45:08 +08:00

22 lines
900 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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 = "yyzw.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)