Spaces:
Runtime error
Runtime error
fix prompts
Browse files
app.py
CHANGED
|
@@ -263,7 +263,7 @@ def inference(img, text, is_translation, prompt=None):
|
|
| 263 |
with torch.no_grad():
|
| 264 |
prefix = clip_model.encode_image(image).to(device, dtype=torch.float32)
|
| 265 |
prefix_embed = model.clip_project(prefix).reshape(1, prefix_length, -1)
|
| 266 |
-
generated_text_prefix = generate_beam(model, tokenizer, embed=prefix_embed, prompt=
|
| 267 |
|
| 268 |
return generated_text_prefix
|
| 269 |
|
|
@@ -274,7 +274,7 @@ examples=[
|
|
| 274 |
["examples/harry.jpeg","", False, "Một bức ảnh về"],
|
| 275 |
["examples/OldTrafford.jpeg","", False, "Một bức ảnh về"],
|
| 276 |
["examples/coffee.jpg","", False, "Một bức ảnh về"],
|
| 277 |
-
["", "What is your name?", True]
|
| 278 |
]
|
| 279 |
|
| 280 |
inputs = [
|
|
|
|
| 263 |
with torch.no_grad():
|
| 264 |
prefix = clip_model.encode_image(image).to(device, dtype=torch.float32)
|
| 265 |
prefix_embed = model.clip_project(prefix).reshape(1, prefix_length, -1)
|
| 266 |
+
generated_text_prefix = generate_beam(model, tokenizer, embed=prefix_embed, prompt=prompt)[0]
|
| 267 |
|
| 268 |
return generated_text_prefix
|
| 269 |
|
|
|
|
| 274 |
["examples/harry.jpeg","", False, "Một bức ảnh về"],
|
| 275 |
["examples/OldTrafford.jpeg","", False, "Một bức ảnh về"],
|
| 276 |
["examples/coffee.jpg","", False, "Một bức ảnh về"],
|
| 277 |
+
["", "What is your name?", True, ""]
|
| 278 |
]
|
| 279 |
|
| 280 |
inputs = [
|