beam-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From OrielResearch Eila Arich-Landkof <e...@orielresearch.org>
Subject Re: saving image object on GCS from DoFn
Date Fri, 27 Apr 2018 16:10:36 GMT
👍 thank you!

On Fri, Apr 27, 2018 at 11:03 AM, Eugene Kirpichov <kirpichov@google.com>
wrote:

> You need to close the file object, I think that should fix the issue.
>
>
> On Fri, Apr 27, 2018, 7:47 AM OrielResearch Eila Arich-Landkof <
> eila@orielresearch.org> wrote:
>
>> I tried with the following code:
>> No error was fired but the file was not created as well
>>
>> import apache_beam.io.filesystems as filesystems
>> fileHandle = filesystems.FileSystems.create(path="gs://bucket/try.png")
>> im.save(fileHandle, "PNG")
>>
>>
>> Could I save it locally on the working machine and copy to gs://
>> is there any unseen data risk involved with that?
>> the code will be the following:
>>
>> im.save("try.png", "PNG")
>> !gsutil cp try.png gs://bucket/try.png
>>
>> Please let me know what your thoughts are
>>
>> Best,
>> Eila
>>
>> On Thu, Apr 26, 2018 at 2:00 PM, Eugene Kirpichov <kirpichov@google.com>
>> wrote:
>>
>>> You can use FileSystems.create()
>>> <https://github.com/apache/beam/blob/master/sdks/python/apache_beam/io/filesystems.py>
>>> to create a file on gs:// and you can pass the result of that method to
>>> img.save().
>>>
>>>
>>> On Thu, Apr 26, 2018, 9:02 AM OrielResearch Eila Arich-Landkof <
>>> eila@orielresearch.org> wrote:
>>>
>>>> Hello all,
>>>>
>>>> I am running the following simplified code from DoFn (ParDo)
>>>>
>>>> from PIL import Image
>>>> img = Image.fromarray(array)img.save('testrgb.png')
>>>>
>>>>
>>>> img.save() with gs:// drive does not work.
>>>> What would be the recommended way to save the img object on google
>>>> drive as .png file
>>>> any advice is appreciated
>>>>
>>>> Many thanks,
>>>> --
>>>> Eila
>>>> www.orielresearch.org
>>>> https://www.meetup.com/Deep-Learning-In-Production/
>>>>
>>>
>>
>>
>> --
>> Eila
>> www.orielresearch.org
>> https://www.meetup.com/Deep-Learning-In-Production/
>>
>


-- 
Eila
www.orielresearch.org
https://www.meetup.com/Deep-Learning-In-Production/

Mime
View raw message