feat(新功能):
fix(修复bug): docs(文档变更): refactor(重构): test(增加测试): Agent generate test
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
@Date :2023/7/26 12:01:05
|
||||
@detail :
|
||||
"""
|
||||
import io
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
@@ -52,15 +53,18 @@ class GenerateImage:
|
||||
image = result.as_numpy("generated_image")
|
||||
image_result = cv2.cvtColor(np.squeeze(image.astype(np.uint8)), cv2.COLOR_RGB2BGR)
|
||||
_, img_byte_array = cv2.imencode('.jpg', image_result)
|
||||
object_name = f'test.jpg'
|
||||
req = oss_upload_image(bucket='test', object_name=object_name, image_bytes=img_byte_array)
|
||||
url = self.minio_client.get_presigned_url(
|
||||
"GET",
|
||||
"test",
|
||||
object_name,
|
||||
expires=timedelta(hours=2),
|
||||
)
|
||||
return url
|
||||
byte_stream = io.BytesIO(img_byte_array)
|
||||
byte_stream.seek(0)
|
||||
|
||||
# object_name = f'test.jpg'
|
||||
# req = oss_upload_image(bucket='test', object_name=object_name, image_bytes=img_byte_array)
|
||||
# url = self.minio_client.get_presigned_url(
|
||||
# "GET",
|
||||
# "test",
|
||||
# object_name,
|
||||
# expires=timedelta(hours=2),
|
||||
# )
|
||||
return byte_stream
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user