27 lines
723 B
Python
27 lines
723 B
Python
|
# pip install zai-sdk
|
||
|
import asyncio
|
||
|
import logging
|
||
|
|
||
|
from Util.GGBUtil import process_geometry_image
|
||
|
|
||
|
# 控制日志输出
|
||
|
logger = logging.getLogger('ShiTu')
|
||
|
logger.setLevel(logging.INFO)
|
||
|
handler = logging.StreamHandler()
|
||
|
handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
|
||
|
logger.addHandler(handler)
|
||
|
|
||
|
|
||
|
# 示例用法
|
||
|
if __name__ == '__main__':
|
||
|
image_url = "https://dsideal.obs.cn-north-1.myhuaweicloud.com/wb/img10.jpg"
|
||
|
|
||
|
async def test():
|
||
|
print("开始流式输出:")
|
||
|
async for content in process_geometry_image(image_url):
|
||
|
if content:
|
||
|
print(content, end="", flush=True)
|
||
|
|
||
|
|
||
|
asyncio.run(test())
|