Models_space / app.py
lcyyyy's picture
Update app.py
7af96ca verified
raw
history blame
399 Bytes
!pip install transformers
from transformers import pipeline
# Step 1: Load the pre-trained model
image_to_text_pipeline = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large")
# Step 2: Test the model by providing an image
image_path = "image.jpg"
generated_text = image_to_text_pipeline(image_path)
# Step 3: Print the generated text
print("Generated Text:", generated_text)