Spaces:
Runtime error
Runtime error
Commit
·
7a1c6c0
1
Parent(s):
f00927c
Update app.py
Browse files
app.py
CHANGED
@@ -203,8 +203,8 @@ visual_examples = [
|
|
203 |
"what is the name of this bird?",
|
204 |
],
|
205 |
[
|
206 |
-
f"{cur_dir}/
|
207 |
-
"
|
208 |
],
|
209 |
[
|
210 |
f"{cur_dir}/examples_waterview.jpg",
|
@@ -228,8 +228,7 @@ def compute_image_state(image):
|
|
228 |
if base64_image in image_cache:
|
229 |
image_state = image_cache[base64_image]
|
230 |
else:
|
231 |
-
image = image_processor(images=image.convert('RGB'), return_tensors='pt')['pixel_values']
|
232 |
-
image = image.to(device)
|
233 |
image_features = visual_encoder.encode_images(image.unsqueeze(0)).squeeze(0) # [L, D]
|
234 |
# apply layer norm to image feature, very important
|
235 |
image_features = F.layer_norm(image_features,
|
|
|
203 |
"what is the name of this bird?",
|
204 |
],
|
205 |
[
|
206 |
+
f"{cur_dir}/examples_woman_and_dog.png",
|
207 |
+
"describe this image",
|
208 |
],
|
209 |
[
|
210 |
f"{cur_dir}/examples_waterview.jpg",
|
|
|
228 |
if base64_image in image_cache:
|
229 |
image_state = image_cache[base64_image]
|
230 |
else:
|
231 |
+
image = image_processor(images=image.convert('RGB'), return_tensors='pt')['pixel_values'].to(device)
|
|
|
232 |
image_features = visual_encoder.encode_images(image.unsqueeze(0)).squeeze(0) # [L, D]
|
233 |
# apply layer norm to image feature, very important
|
234 |
image_features = F.layer_norm(image_features,
|