|
|
|
@ -1,7 +1,8 @@
|
|
|
|
|
import time
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
|
|
async def is_text_dominant(client,image_url):
|
|
|
|
|
|
|
|
|
|
async def is_text_dominant(client, image_url):
|
|
|
|
|
"""
|
|
|
|
|
判断图片是否主要是文字内容
|
|
|
|
|
:param image_url: 图片 URL
|
|
|
|
@ -34,7 +35,7 @@ async def is_text_dominant(client,image_url):
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def recognize_text(client,image_url):
|
|
|
|
|
async def recognize_text(client, pool, image_url):
|
|
|
|
|
"""
|
|
|
|
|
识别图片中的文字,流式输出
|
|
|
|
|
"""
|
|
|
|
@ -64,7 +65,7 @@ async def recognize_text(client,image_url):
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def recognize_content(client,image_url):
|
|
|
|
|
async def recognize_content(client, pool, image_url):
|
|
|
|
|
"""
|
|
|
|
|
识别图片中的内容,流式输出
|
|
|
|
|
"""
|
|
|
|
@ -80,4 +81,4 @@ async def recognize_content(client,image_url):
|
|
|
|
|
if chunk.choices[0].delta.content is not None:
|
|
|
|
|
for char in chunk.choices[0].delta.content:
|
|
|
|
|
yield char
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|
time.sleep(0.1)
|
|
|
|
|