Spaces:
Runtime error
Runtime error
visheratin
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -49,11 +49,12 @@ def answer_question(image, question, max_crops, num_tokens):
|
|
49 |
<|im_start|>assistant
|
50 |
"""
|
51 |
streamer = TextIteratorStreamer(processor.tokenizer, skip_special_tokens=True)
|
52 |
-
|
|
|
53 |
generation_kwargs = {
|
54 |
"input_ids": inputs["input_ids"],
|
55 |
"attention_mask": inputs["attention_mask"],
|
56 |
-
"image_features":
|
57 |
"streamer": streamer,
|
58 |
"max_length": 1000,
|
59 |
"use_cache": True,
|
|
|
49 |
<|im_start|>assistant
|
50 |
"""
|
51 |
streamer = TextIteratorStreamer(processor.tokenizer, skip_special_tokens=True)
|
52 |
+
with torch.inference_mode():
|
53 |
+
inputs = processor(prompt, [image], model, max_crops=max_crops, num_tokens=num_tokens)
|
54 |
generation_kwargs = {
|
55 |
"input_ids": inputs["input_ids"],
|
56 |
"attention_mask": inputs["attention_mask"],
|
57 |
+
"image_features": inputs["image_features"],
|
58 |
"streamer": streamer,
|
59 |
"max_length": 1000,
|
60 |
"use_cache": True,
|