|
1 | 1 | # Prediction interface for Cog ⚙️ |
2 | | -# Reference: https://github.com/replicate/cog/blob/main/docs/python.md |
| 2 | +# https://github.com/replicate/cog/blob/main/docs/python.md |
3 | 3 |
|
4 | | -import cog |
5 | | -# import torch |
| 4 | +from cog import BasePredictor, Input, Path |
6 | 5 |
|
7 | | -class Predictor(cog.Predictor): |
| 6 | + |
| 7 | +class Predictor(BasePredictor): |
8 | 8 | def setup(self): |
9 | | - """Load the model into memory to make running multiple predictions efficient""" |
10 | | - # self.model = torch.load("./weights.pth") |
| 9 | + """Load the model into memory to make running multiple predictions efficient""" |
| 10 | + # self.model = torch.load("./weights.pth") |
11 | 11 |
|
12 | | - @cog.input("image", type=cog.Path, help="Grayscale input image") |
13 | | - @cog.input("scale", type=float, default=1.5, help="Factor to scale image by") |
14 | | - def predict(self, image): |
| 12 | + def predict( |
| 13 | + self, |
| 14 | + input: Path = Input(title="Grayscale input image"), |
| 15 | + scale: float = Input( |
| 16 | + title="Factor to scale image by", gt=0, lt=10, default=1.5 |
| 17 | + ), |
| 18 | + ) -> Path: |
15 | 19 | """Run a single prediction on the model""" |
16 | | - # processed_input = preprocess(image) |
17 | | - # output = self.model(processed_input) |
18 | | - # return post_processing(output) |
| 20 | + # processed_input = preprocess(input) |
| 21 | + # output = self.model(processed_input, scale) |
| 22 | + # return postprocess(output) |
0 commit comments