https://flyte.org logo
#ask-the-community
Title
# ask-the-community
j

Jun Kwan

10/14/2022, 11:34 AM
Hi guys, I am currently following tutorial https://docs.flyte.org/projects/cookbook/en/stable/auto/integrations/flytekit_plugins/onnx_examples/pytorch_onnx.html However, when I want to save image to my current directory by changing to code to
Copy code
final_img = Image.merge(
        "YCbCr",
        [
            img_out_y,
            img_cb.resize(img_out_y.size, Image.BICUBIC),
            img_cr.resize(img_out_y.size, Image.BICUBIC),
        ],
    ).convert("RGB")

    img_path = (
        Path("cat_superres_with_ort.jpg")
    )
    final_img.save(img_path)
Where can I find cat_superres_with_ort.jpg? Thanks!
s

Samhita Alla

10/14/2022, 11:59 AM
@Jun Kwan, the code in docs saves the image to that file. If you want to save the image to your current directory, just write
img_path = "cat_superres_with_ort.jpg"
.
j

Jun Kwan

10/14/2022, 12:00 PM
@Samhita Alla thanks for your reply, when I open my current directory, I don't see the jpg file, is it because it is stored within the docker container but not in my local disk?
s

Samhita Alla

10/14/2022, 12:01 PM
How are you running the code?
j

Jun Kwan

10/14/2022, 12:04 PM
Copy code
flytectl sandbox start --source .
flytectl sandbox exec -- docker build . --tag "my_flyte_project:v1"
pyflyte --pkgs example package --image "my_flyte_project:v1"
flytectl register files --project flytesnacks --domain development --archive flyte-package.tgz --version v1
pyflyte run --remote example.py wf --image "my_flyte_project:v1"
@Samhita Alla I was trying to deploy to my local server
everything is fine, just wanna know where does the docker store
cat_superres_with_ort.jpg
s

Samhita Alla

10/14/2022, 12:07 PM
Have you checked in the docker container?
Also since that file is being returned as a FlyteFile, you can download it directly. On the console, you should see a s3 uri that you can download.
j

Jun Kwan

10/14/2022, 12:10 PM
Oh yea, i guess i am not too sure how do i download using s3 uri
Do you have a guide for that? @Samhita Alla
s

Samhita Alla

10/14/2022, 12:14 PM
Go to http://localhost:30088 (creds: minio & miniostorage), follow the bucket path and download the file (there should be a download button available).
j

Jun Kwan

10/14/2022, 12:36 PM
@Samhita Alla problem solved, thanks!
@Samhita Alla just wondering why is the file not saved to my local disk?
s

Samhita Alla

10/14/2022, 1:02 PM
Since you’re running the code on docker container, it won’t be saved in your current directory. The file should be available in the docker container, though.
j

Jun Kwan

10/14/2022, 1:06 PM
@Samhita Alla is there any way to make it save in the local disk? i always run pyflyte --remote options
s

Samhita Alla

10/14/2022, 1:12 PM
I don’t think you can do that. May I know why you want to save the file in your local directory?
j

Jun Kwan

10/14/2022, 1:13 PM
Just wanna open and check the file whenever I save a file in a container. Now the extra step is to go to localhost:30088 to check the output file, but i guess that's fine too. Thanks for your help! @Samhita Alla
s

Samhita Alla

10/14/2022, 1:15 PM
Um gotcha. You can run the code locally without the --remote option in case you want to test it multiple times and view the file after every run.
j

Jun Kwan

10/14/2022, 1:17 PM
@Samhita Alla yea that works perfectly fine, but I wouldnt be able to use the console if I run it without the --remote option
23 Views