Update README.md
Browse files
README.md
CHANGED
@@ -12,27 +12,3 @@ Siglip2-base-patch16-224(https://huggingface.co/google/siglip2-base-patch16-224)
|
|
12 |
사용된 평가 데이터 : https://huggingface.co/datasets/hyunlord/aihub_image-caption_en-ko_karpathy-split (test)
|
13 |
|
14 |
## How to use
|
15 |
-
|
16 |
-
```python
|
17 |
-
import requests
|
18 |
-
import torch
|
19 |
-
from PIL import Image
|
20 |
-
from transformers import AutoModel, AutoProcessor
|
21 |
-
|
22 |
-
repo = "Bingsu/clip-vit-base-patch32-ko"
|
23 |
-
model = AutoModel.from_pretrained(repo)
|
24 |
-
processor = AutoProcessor.from_pretrained(repo)
|
25 |
-
|
26 |
-
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
|
27 |
-
image = Image.open(requests.get(url, stream=True).raw)
|
28 |
-
inputs = processor(text=["고양이 두 마리", "개 두 마리"], images=image, return_tensors="pt", padding=True)
|
29 |
-
with torch.inference_mode():
|
30 |
-
outputs = model(**inputs)
|
31 |
-
logits_per_image = outputs.logits_per_image
|
32 |
-
probs = logits_per_image.softmax(dim=1)
|
33 |
-
```
|
34 |
-
|
35 |
-
```python
|
36 |
-
>>> probs
|
37 |
-
tensor([[0.9926, 0.0074]])
|
38 |
-
```
|
|
|
12 |
사용된 평가 데이터 : https://huggingface.co/datasets/hyunlord/aihub_image-caption_en-ko_karpathy-split (test)
|
13 |
|
14 |
## How to use
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|