Spaces:
Runtime error
Runtime error
Update app.py
Browse files24 unmodified lines25262728293028293031323334353624 unmodified lines ]) image_tensor = transform(image).unsqueeze(0).to(device) # Generate caption with the fixed prompt input_text = FIXED_PROMPT + " " output = model.generate(pixel_values=image_tensor, input_text=input_text) # Prepend the fixed prompt to the input tensor fixed_prompt_tensor = tokenizer(FIXED_PROMPT, return_tensors="pt").input_ids.to(device) input_tensor = torch.cat((fixed_prompt_tensor, image_tensor), dim=1) # Generate caption output = model.generate(pixel_values=image_tensor) caption = tokenizer.decode(output[0], skip_special_tokens=True) return caption
app.py+6-3