You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue:
Should the command be "upscaled_image.save(output_path)" instead of "upscaled_image.save(output)" ?
I am a a bit confused by where does the "output" varaible comes from.
Thanks for clarifying.
Tutorial example code:
import tempfile
from cog import BasePredictor, Input, Path
class Predictor(BasePredictor):
def predict(self, image: Path = Input(description="Image to enlarge")) -> Path:
upscaled_image = do_some_processing(image)
# To output `cog.Path` objects the file needs to exist, so create a temporary file first.
# This file will automatically be deleted by Cog after it has been returned.
output_path = Path(tempfile.mkdtemp()) / "upscaled.png"
upscaled_image.save(output)
return Path(output_path)
The text was updated successfully, but these errors were encountered:
Hi @wongshumhei. The code in that example is pseudocode, but yes you're correct that it should be using output_path instead of output. I've opened a PR to correct that here: #1464
Documentation link:
https://github.com/replicate/cog/blob/main/docs/python.md#path
Issue:
Should the command be "upscaled_image.save(output_path)" instead of "upscaled_image.save(output)" ?
I am a a bit confused by where does the "output" varaible comes from.
Thanks for clarifying.
Tutorial example code:
import tempfile
from cog import BasePredictor, Input, Path
class Predictor(BasePredictor):
def predict(self, image: Path = Input(description="Image to enlarge")) -> Path:
upscaled_image = do_some_processing(image)
The text was updated successfully, but these errors were encountered: