cog icon indicating copy to clipboard operation
cog copied to clipboard

Failure to return files without output_file_prefix

Open Medoalmasry opened this issue 1 year ago • 2 comments

I don't have "A base URL to upload output files to. src" How can I possibly retrieve the file as a response?

I used the example here

from cog import BasePredictor, File, Input, Path
from PIL import Image

class Predictor(BasePredictor):
    def predict(self, source_image: File = Input(description="Image to enlarge")) -> File:
        pillow_img = Image.open(source_image)
        upscaled_image = do_some_processing(pillow_img)
        return File(upscaled_image)

Building is successful but the predict function produces the following error:- ⅹ /predictions call returned status 500

Medoalmasry avatar Aug 20 '23 14:08 Medoalmasry

Hi, @Medoalmasry I'm also getting the same error. Have you found any solution? Thanks

satani99 avatar Nov 27 '23 05:11 satani99

Indeed, File() does not seem to accept parameters. My approach is to return a Path instead of a File, but I can't say I'm having great success either. It would be nice to update the documentation for File with an example that works.

manu-sapiens avatar Apr 10 '24 01:04 manu-sapiens