Update README.md
Browse files
README.md
CHANGED
@@ -9,6 +9,8 @@
|
|
9 |
Use the code below to get started with the model.
|
10 |
|
11 |
```python
|
|
|
|
|
12 |
from PIL import Image
|
13 |
from transformers import AutoProcessor, AutoModelForVision2Seq
|
14 |
|
@@ -17,7 +19,9 @@ model = AutoModelForVision2Seq.from_pretrained("ydshieh/kosmos-2-patch14-224", t
|
|
17 |
processor = AutoProcessor.from_pretrained("ydshieh/kosmos-2-patch14-224", trust_remote_code=True)
|
18 |
|
19 |
prompt = "<grounding>An image of"
|
20 |
-
|
|
|
|
|
21 |
|
22 |
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
23 |
|
|
|
9 |
Use the code below to get started with the model.
|
10 |
|
11 |
```python
|
12 |
+
import requests
|
13 |
+
|
14 |
from PIL import Image
|
15 |
from transformers import AutoProcessor, AutoModelForVision2Seq
|
16 |
|
|
|
19 |
processor = AutoProcessor.from_pretrained("ydshieh/kosmos-2-patch14-224", trust_remote_code=True)
|
20 |
|
21 |
prompt = "<grounding>An image of"
|
22 |
+
|
23 |
+
url = "https://huggingface.co/ydshieh/kosmos-2-patch14-224/resolve/main/snowman.jpg"
|
24 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
25 |
|
26 |
inputs = processor(text=prompt, images=image, return_tensors="pt")
|
27 |
|