famousdetectiveadrianmonk
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -55,8 +55,7 @@ Person:
|
|
55 |
Provide the description as a JSON object matching the schema.
|
56 |
"""
|
57 |
|
58 |
-
dataset = load_dataset('person-attributes')
|
59 |
-
|
60 |
|
61 |
msgs = []
|
62 |
for gender, age, race in product(
|
@@ -92,17 +91,27 @@ for gender, age, race in product(
|
|
92 |
{'role': 'assistant', 'content': [answer]},
|
93 |
])
|
94 |
|
95 |
-
|
96 |
|
97 |
img = Image.open(...)
|
98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
for _ in range(10):
|
101 |
try:
|
102 |
res = model.chat(
|
103 |
image=None,
|
104 |
msgs= [*msgs,
|
105 |
-
{'role': 'user', 'content': [
|
106 |
|
107 |
tokenizer=tokenizer
|
108 |
)
|
|
|
55 |
Provide the description as a JSON object matching the schema.
|
56 |
"""
|
57 |
|
58 |
+
dataset = load_dataset('famousdetectiveadrianmonk/person-attributes-fewshot')['train']
|
|
|
59 |
|
60 |
msgs = []
|
61 |
for gender, age, race in product(
|
|
|
91 |
{'role': 'assistant', 'content': [answer]},
|
92 |
])
|
93 |
|
94 |
+
del dataset
|
95 |
|
96 |
img = Image.open(...)
|
97 |
+
resized_img = img.resize((256,256)) # or crop
|
98 |
+
|
99 |
+
|
100 |
+
if False:
|
101 |
+
# you can test with this example image
|
102 |
+
dataset = load_dataset("TryOnVirtual/VITON-HD-Captions")
|
103 |
+
example = dataset['train'].shuffle().take(1)[0]
|
104 |
+
img = example['image']
|
105 |
+
crop_size = min(img.size)
|
106 |
+
resized_img = img.crop((0,0,crop_size,crop_size)).resize((256,256))
|
107 |
+
|
108 |
|
109 |
for _ in range(10):
|
110 |
try:
|
111 |
res = model.chat(
|
112 |
image=None,
|
113 |
msgs= [*msgs,
|
114 |
+
{'role': 'user', 'content': [resized_img, question]}],
|
115 |
|
116 |
tokenizer=tokenizer
|
117 |
)
|