Skip to content

Commit df37720

Browse files
committed
Use cog-runtime for some images
1 parent dd76996 commit df37720

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

canary/cog.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build:
2-
python_version: "3.8"
2+
python_version: "3.13"
3+
cog_runtime: true
34
predict: "predict.py:Predictor"

hello-image/cog.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
build:
2-
python_version: "3.11"
2+
python_version: "3.13"
3+
cog_runtime: true
34
predict: "predict.py:Predictor"

hello-image/predict.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
from cog import BasePredictor, Path
2+
from tempfile import NamedTemporaryFile
23

34
class Predictor(BasePredictor):
45
def predict(self) -> Path:
5-
return Path("hello.webp")
6+
# Copy output file, workaround for some cog version deleting output after upload
7+
with open("/tmp/hello.webp", "wb") as f:
8+
f.write(open("hello.webp", "rb").read())
9+
return Path("/tmp/hello.webp")

0 commit comments

Comments
 (0)