wsj1995 commited on
Commit
5ae8d7f
·
verified ·
1 Parent(s): 252f0fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -64,8 +64,8 @@ def run(url,quality,output_format,storage,access_key_id,access_key_secret,securi
64
  downloaded_image = download_image(url)
65
 
66
  if downloaded_image:
 
67
  if access_key_id and endpoint and bucket_name:
68
- output_image_path = remove_metadata(downloaded_image,result_image)
69
  # 步骤 3:上传到阿里云 OSS
70
  oss_url = upload_to_oss(output_image_path, upload_filename, bucket_name, access_key_id, access_key_secret,securityToken, endpoint)
71
 
@@ -76,9 +76,9 @@ def run(url,quality,output_format,storage,access_key_id,access_key_secret,securi
76
  else:
77
  return "上传到 OSS 失败"
78
  else:
79
- with open(result_image,'rb') as f:
80
  image_base64 = base64.b64encode(f.read())
81
- delete_local_file(result_image) # 删除压缩后的图片
82
  return image_base64
83
  else:
84
  return '图片下载失败'
 
64
  downloaded_image = download_image(url)
65
 
66
  if downloaded_image:
67
+ output_image_path = remove_metadata(downloaded_image,result_image)
68
  if access_key_id and endpoint and bucket_name:
 
69
  # 步骤 3:上传到阿里云 OSS
70
  oss_url = upload_to_oss(output_image_path, upload_filename, bucket_name, access_key_id, access_key_secret,securityToken, endpoint)
71
 
 
76
  else:
77
  return "上传到 OSS 失败"
78
  else:
79
+ with open(output_image_path,'rb') as f:
80
  image_base64 = base64.b64encode(f.read())
81
+ delete_local_file(output_image_path) # 删除压缩后的图片
82
  return image_base64
83
  else:
84
  return '图片下载失败'