Commit 87a30f1 1 parent 80760dd commit 87a30f1 Copy full SHA for 87a30f1
File tree 2 files changed +16
-6
lines changed
examples/image_segmentation
2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change
1
+ # Image Segmentation pytorch example.
2
+
3
+ This is an example of a pytorch model
4
+
5
+ ## Deploy to Baseten
6
+ To deploy the model, run the following from the root of the directory
7
+
8
+ ```
9
+ import baseten, truss. os
10
+
11
+ sd = truss.load("./examples/stable-diffusion-2-1")
12
+
13
+ baseten.login(os.environ["BASETEN_API_KEY"])
14
+
15
+ baseten.deploy(sd, model_name"My Pytorch Model", publish=True)
16
+ ```
Original file line number Diff line number Diff line change @@ -28,12 +28,6 @@ def load(self):
28
28
self ._model = models .segmentation .deeplabv3_resnet101 (pretrained = 1 ).eval ()
29
29
self ._device = torch .device ("cuda:0" if torch .cuda .is_available () else "cpu" )
30
30
31
- def preprocess (self , request : Dict ) -> Dict :
32
- return request
33
-
34
- def postprocess (self , request : Dict ) -> Dict :
35
- return request
36
-
37
31
def predict (self , request : Dict ) -> Dict [str , List ]:
38
32
return [self ._predict_single (instance ) for instance in request ["instances" ]]
39
33
You can’t perform that action at this time.
0 commit comments