Skip to content

Commit

Permalink
Fix README (output extension must be .png)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkentaro committed Feb 12, 2024
1 parent e9e9889 commit 835c7da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
File renamed without changes
File renamed without changes
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ Here are models that can be downloaded:

```bash
# Run a model with an image
osam run efficient-sam:25m --image examples/_images/dogs.jpg > output.jpg
osam run efficient-sam:25m --image examples/_images/dogs.jpg > output.png

# Get a JSON output
osam run efficient-sam:25m --image examples/_images/dogs.jpg --json
# {"model": "efficient-sam:25m", "mask": "..."}

# Give a prompt
osam run efficient-sam:25m --image examples/_images/dogs.jpg \
--prompt '{"points": [[1439, 504], [1439, 1289]], "point_labels": [1, 1]}' > output.jpg
--prompt '{"points": [[1439, 504], [1439, 1289]], "point_labels": [1, 1]}' > output.png
```

<img src="examples/_images/dogs.jpg" width="35%"> <img src=".readme/dogs_output.jpg" width="35%">
<i>Input and output images ('dogs.jpg', 'output.jpg').</i>
<img src="examples/_images/dogs.jpg" width="35%"> <img src=".readme/dogs_output.png" width="35%">
<i>Input and output images ('dogs.jpg', 'output.png').</i>

### Python

Expand All @@ -86,10 +86,10 @@ request = osam.types.GenerateRequest(
prompt=osam.types.Prompt(points=[[1439, 504], [1439, 1289]], point_labels=[1, 1]),
)
response = osam.apis.generate(request=request)
PIL.Image.fromarray(response.mask).save("mask.jpg")
PIL.Image.fromarray(response.mask).save("mask.png")
```
<img src="examples/_images/dogs.jpg" width="35%"> <img src=".readme/dogs_mask.jpg" width="35%">
<i>Input and output images ('dogs.jpg', 'mask.jpg').</i>
<img src="examples/_images/dogs.jpg" width="35%"> <img src=".readme/dogs_mask.png" width="35%">
<i>Input and output images ('dogs.jpg', 'mask.png').</i>

### HTTP

Expand All @@ -101,7 +101,7 @@ osam serve
curl 127.0.0.1:11368/api/generate -X POST \
-H "Content-Type: application/json" \
-d "{\"model\": \"efficient-sam:25m\", \"image\": \"$(cat examples/_images/dogs.jpg | base64)\"}" \
| jq -r .mask | base64 --decode > mask.jpg
| jq -r .mask | base64 --decode > mask.png
```

## License
Expand Down

0 comments on commit 835c7da

Please sign in to comment.