File size: 295 Bytes
3f05b71
1a8bb86
3f05b71
1a8bb86
3f05b71
1a8bb86
 
 
1
2
3
4
5
6
7
8
9

from transformers import pipeline

image_to_text = pipeline("image-to-text", model="nlpconnect/vit-gpt2-image-captioning")

image_to_text("https://ankur3107.github.io/assets/images/image-captioning-example.png")

# [{'generated_text': 'a soccer game with a player jumping to catch the ball '}]