Update md.py
Browse files
md.py
CHANGED
|
@@ -4,14 +4,14 @@ import requests
|
|
| 4 |
from PIL import Image, ImageDraw
|
| 5 |
from transformers import AutoProcessor, Kosmos2_5ForConditionalGeneration
|
| 6 |
|
| 7 |
-
repo = "
|
| 8 |
device = "cuda:0"
|
| 9 |
dtype = torch.bfloat16
|
| 10 |
model = Kosmos2_5ForConditionalGeneration.from_pretrained(repo, device_map=device, torch_dtype=dtype)
|
| 11 |
processor = AutoProcessor.from_pretrained(repo)
|
| 12 |
|
| 13 |
# sample image
|
| 14 |
-
url = "https://huggingface.co/
|
| 15 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 16 |
|
| 17 |
prompt = "<md>"
|
|
|
|
| 4 |
from PIL import Image, ImageDraw
|
| 5 |
from transformers import AutoProcessor, Kosmos2_5ForConditionalGeneration
|
| 6 |
|
| 7 |
+
repo = "ydshieh/kosmos-2.5"
|
| 8 |
device = "cuda:0"
|
| 9 |
dtype = torch.bfloat16
|
| 10 |
model = Kosmos2_5ForConditionalGeneration.from_pretrained(repo, device_map=device, torch_dtype=dtype)
|
| 11 |
processor = AutoProcessor.from_pretrained(repo)
|
| 12 |
|
| 13 |
# sample image
|
| 14 |
+
url = "https://huggingface.co/ydshieh/kosmos-2.5/blob/main/receipt_00008.png"
|
| 15 |
image = Image.open(requests.get(url, stream=True).raw)
|
| 16 |
|
| 17 |
prompt = "<md>"
|