save code

This commit is contained in:
xsl
2026-02-27 22:56:59 +08:00
parent 73e356def7
commit 339e7dc1f6
5 changed files with 207 additions and 16 deletions
+4 -4
View File
@@ -2,10 +2,10 @@ import oss2
def upload_to_oss(image_path, object_name=None):
# 配置信息(替换为你的实际信息)
access_key_id = 'LTAI5tB9t2RH6f1drSLvVLLZ'
access_key_secret = '91uzPI1RAFHN7n3Y6TJDGFP8w0dG1R'
access_key_id = 'LTAI5tGp1sLzedqxihcNC1eb'
access_key_secret = 'IFZE1b8YYreCP6zfA6GaZ9uBT678qO'
endpoint = 'oss-cn-beijing.aliyuncs.com' # 替换为你的Endpoint
bucket_name = 'llyz'
bucket_name = 'xiangsilian'
# 创建Bucket实例
auth = oss2.Auth(access_key_id, access_key_secret)
@@ -34,5 +34,5 @@ def upload_to_oss(image_path, object_name=None):
# 使用示例
image_path = '/home/xsl/code/ComfyUI/change_cloth/girl8010.jpg' # 本地图片路径
upload_to_oss(image_path, 'girl8011.jpg') # 第二个参数可选,指定OSS上的路径
https_url = f'https://llyz.oss-cn-beijing.aliyuncs.com/girl8011.jpg'
https_url = f'https://xiangsilian.oss-cn-beijing.aliyuncs.com/girl8011.jpg'
print(f"生成的HTTPS URL: {https_url}")