NagaSaiAbhinay commited on
Commit
6463f84
·
verified ·
1 Parent(s): ff4f79e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +13 -5
README.md CHANGED
@@ -11,13 +11,21 @@ Inspired by [vvmatorin/CSD](https://huggingface.co/vvmatorin/CSD), the differenc
11
  Inference:
12
 
13
  ```python
 
 
14
  from PIL import Image
15
- from transformers import AutoProcessor, AutoModel
16
 
17
- model = AutoModel.from_pretrained("NagaSaiAbhinay/CSD", trust_remote_code=True)
18
- processor = AutoProcessor.from_pretrained("NagaSaiAbhinay/CSD")
 
 
19
 
20
- img = Image.open('test_image.png')
21
- pixel_values = processor
22
 
 
 
 
 
23
  ```
 
11
  Inference:
12
 
13
  ```python
14
+ import torch
15
+ import requests
16
  from PIL import Image
17
+ from transformers import AutoModel, AutoConfig, AutoProcessor
18
 
19
+ image_url = "https://midjourneysref.com/cdn-cgi/image/format=webp,quality=80,fit=cover/https://explore.midjourneysref.com/1541138391-4-219d8b0b"
20
+ def load_image(url):
21
+ im = Image.open(requests.get(url, stream=True).raw)
22
+ return im
23
 
24
+ processor = AutoProcessor.from_pretrained('NagaSaiAbhinay/CSD')
25
+ model = AutoModel.from_pretrained('NagaSaiAbhinay/CSD', trust_remote_code=True).to("cuda")
26
 
27
+ im = load_image(image_url)
28
+ processed_image = processor(images=im, return_tensors='pt').to('cuda')
29
+ processed_image = processed_image['pixel_values']
30
+ _, style_vector, _ = model(processed_image)
31
  ```