-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from kauevestena/main
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
FROM pytorch/pytorch:latest | ||
|
||
# prevent apt from hanging | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# create workspace | ||
ENV HOME /workspace | ||
WORKDIR $HOME | ||
|
||
# dependency: lang-segment-anything | ||
RUN apt update | ||
|
||
# installing system dependencies: | ||
RUN apt install -y git | ||
RUN apt install libgl1-mesa-glx -y | ||
RUN apt install libglib2.0-0 -y | ||
|
||
# copy source code: | ||
COPY . $HOME/lang-segment-anything | ||
|
||
# installing python dependencies: | ||
WORKDIR $HOME/lang-segment-anything | ||
RUN pip install -e . | ||
|
||
# running the basic test, | ||
# then it will held the weights inside the image, | ||
# so no "cold start" | ||
RUN python running_test.py | ||
|
||
# running the app: | ||
CMD ["lightning", "run", "app", "app.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
''' | ||
This is just adapted from the example in the readme, | ||
The main usage is for the built image to have the weights cached. | ||
''' | ||
|
||
from PIL import Image | ||
from lang_sam import LangSAM | ||
|
||
model = LangSAM() | ||
image_pil = Image.open("./assets/car.jpeg").convert("RGB") | ||
text_prompt = "wheel" | ||
masks, boxes, phrases, logits = model.predict(image_pil, text_prompt) | ||
|
||
print('all ok') |