When I use this as a lib, I can not access the Internet, it keeps failed as it attempt to access huggingface.co, how to adapt to it.
Use as a library:
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)
Use with custom checkpoint:
First download a model checkpoint.
from PIL import Image
from lang_sam import LangSAM
model = LangSAM("<model_type>", "<path/to/checkpoint>")
image_pil = Image.open("./assets/car.jpeg").convert("RGB")
text_prompt = "wheel"
masks, boxes, phrases, logits = model.predict(image_pil, text_prompt)
When I use this as a lib, I can not access the Internet, it keeps failed as it attempt to access huggingface.co, how to adapt to it.