diff --git a/AI/Doc/AI硬件研究需要购买的物件清单V20250328.docx b/AI/Doc/AI硬件研究需要购买的物件清单V20250328.docx index 253cd401..e22fa37d 100644 Binary files a/AI/Doc/AI硬件研究需要购买的物件清单V20250328.docx and b/AI/Doc/AI硬件研究需要购买的物件清单V20250328.docx differ diff --git a/AI/Doc/~$硬件研究需要购买的物件清单V20250328.docx b/AI/Doc/~$硬件研究需要购买的物件清单V20250328.docx new file mode 100644 index 00000000..b302e282 Binary files /dev/null and b/AI/Doc/~$硬件研究需要购买的物件清单V20250328.docx differ diff --git a/AI/WxMini/Start.py b/AI/WxMini/Start.py index b4901aba..40700283 100644 --- a/AI/WxMini/Start.py +++ b/AI/WxMini/Start.py @@ -604,15 +604,10 @@ async def process_image(image_url: str, current_user: dict = Depends(get_current :return: 流式输出结果 """ try: - if await is_text_dominant(client, image_url): - logger.info("检测到图片主要是文字内容,开始识别文字:") - return StreamingResponse(recognize_text(client, app.state.mysql_pool, current_user['person_id'], image_url), - media_type="text/plain") - else: - print("检测到图片主要是物体/场景,开始识别内容:") - return StreamingResponse( - recognize_content(client, app.state.mysql_pool, current_user['person_id'], image_url), - media_type="text/plain") + print("检测到图片主要是物体/场景,开始识别内容:") + return StreamingResponse( + recognize_content(client, app.state.mysql_pool, current_user['person_id'], image_url), + media_type="text/plain") except Exception as e: raise HTTPException(status_code=500, detail=str(e)) diff --git a/AI/WxMini/Utils/ImageUtil.py b/AI/WxMini/Utils/ImageUtil.py index 0e71064e..7d4c56bb 100644 --- a/AI/WxMini/Utils/ImageUtil.py +++ b/AI/WxMini/Utils/ImageUtil.py @@ -1,42 +1,7 @@ import time -import re from WxMini.Utils.MySQLUtil import save_chat_to_mysql - -async def is_text_dominant(client, image_url): - """ - 判断图片是否主要是文字内容 - :param image_url: 图片 URL - :return: True(主要是文字) / False(主要是物体/场景) - """ - completion = await client.chat.completions.create( - model="qwen-vl-ocr", - messages=[ - { - "role": "user", - "content": [ - { - "type": "image_url", - "image_url": image_url, - "min_pixels": 28 * 28 * 4, - "max_pixels": 28 * 28 * 1280 - }, - {"type": "text", "text": "Read all the text in the image."}, - ] - } - ], - stream=False - ) - text = completion.choices[0].message.content - - # 判断是否只有英文和数字 - if re.match(r'^[A-Za-z0-9\s]+$', text): - print("识别到的内容只有英文和数字,可能是无意义的字符,调用识别内容功能。") - return False - return True - - async def recognize_text(client, pool, person_id, image_url): """ 识别图片中的文字,流式输出,并将结果记录到数据库