Spaces:
Sleeping
Sleeping
Update Image_text_generation.py
Browse files35 unmodified lines363738394041423 unmodified lines4647484950515253545535 unmodified linesreturn part.inline_data.datareturn Nonedef upload_image_to_tmp(self, image_binary):"""返回:str: 上傳後的圖片 URL,如果上傳失敗則返回 None。3 unmodified linesimage = PIL.Image.open(io.BytesIO(image_binary))# 建立暫存檔案以便上傳image.save('tmp/temp.png', format='PNG')# 返回圖片的連結return 'tmp/temp.png'except Exception as e:print(f"圖片上傳失敗: {e}")return None35 unmodified lines363738394041423 unmodified lines4647484950515253545535 unmodified linesreturn part.inline_data.datareturn Nonedef upload_image_to_tmp(self, user_id):"""返回:str: 上傳後的圖片 URL,如果上傳失敗則返回 None。3 unmodified linesimage = PIL.Image.open(io.BytesIO(image_binary))# 建立暫存檔案以便上傳image.save('tmp/'+user_id+'.png', format='PNG')# 返回圖片的連結return 'tmp/'+user_id+'.png'except Exception as e:print(f"圖片上傳失敗: {e}")return None
Image_text_generation.py+3-3