abiyyufahri commited on
Commit
c3c9d97
·
verified ·
1 Parent(s): 7077007

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -168,11 +168,20 @@ def extract_coordinates(text):
168
 
169
  def cpu_inference(conversation, model, tokenizer, processor):
170
  try:
 
 
 
 
 
 
 
171
  inputs = processor(
172
- conversation,
 
173
  return_tensors="pt",
174
  padding=True,
175
- truncation=True
 
176
  )
177
 
178
  with torch.no_grad():
 
168
 
169
  def cpu_inference(conversation, model, tokenizer, processor):
170
  try:
171
+ prompt = processor.apply_chat_template(
172
+ conversation,
173
+ tokenize=False,
174
+ add_generation_prompt=True
175
+ )
176
+
177
+ image = conversation[1]["content"][0]["image"]
178
  inputs = processor(
179
+ text=[prompt],
180
+ images=[image],
181
  return_tensors="pt",
182
  padding=True,
183
+ truncation=True,
184
+ max_length=512
185
  )
186
 
187
  with torch.no_grad():