fix
This commit is contained in:
parent
ba9b187dcc
commit
a403daa314
@ -1256,22 +1256,21 @@ async def upload_file(prompt_id, filename, subfolder=None, content_type="image/p
|
|||||||
logger.info(f"Result: {ok}")
|
logger.info(f"Result: {ok}")
|
||||||
|
|
||||||
async with aiofiles.open(file, 'rb') as f:
|
async with aiofiles.open(file, 'rb') as f:
|
||||||
# data = await f.read()
|
data = await f.read()
|
||||||
|
size = str(len(data))
|
||||||
# size = str(len(data))
|
|
||||||
# logger.info(f"Image size: {size}")
|
# logger.info(f"Image size: {size}")
|
||||||
|
|
||||||
start_time = time.time() # Start timing here
|
start_time = time.time() # Start timing here
|
||||||
headers = {
|
headers = {
|
||||||
"Content-Type": content_type,
|
"Content-Type": content_type,
|
||||||
# "Content-Length": size,
|
"Content-Length": size,
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok.get('include_acl') is True:
|
if ok.get('include_acl') is True:
|
||||||
headers["x-amz-acl"] = "public-read"
|
headers["x-amz-acl"] = "public-read"
|
||||||
|
|
||||||
# response = requests.put(ok.get("url"), headers=headers, data=data)
|
# response = requests.put(ok.get("url"), headers=headers, data=data)
|
||||||
response = await async_request_with_retry('PUT', ok.get("url"), headers=headers, data=file_sender(f, chunk_size))
|
response = await async_request_with_retry('PUT', ok.get("url"), headers=headers, data=data)
|
||||||
logger.info(f"Upload file response status: {response.status}, status text: {response.reason}")
|
logger.info(f"Upload file response status: {response.status}, status text: {response.reason}")
|
||||||
end_time = time.time() # End timing after the request is complete
|
end_time = time.time() # End timing after the request is complete
|
||||||
logger.info("Upload time: {:.2f} seconds".format(end_time - start_time))
|
logger.info("Upload time: {:.2f} seconds".format(end_time - start_time))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user