Downloads · 30 days
0
lcyyyy/image-to-text
image-to-text is a machine learning model from lcyyyy. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
0
Access
Public
Updated Mar 21, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 72%
From the Hugging Face model README
from transformers import pipeline
image_to_text_pipeline = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large")
uploaded_files = get_uploaded_files() if not uploaded_files: print("Please upload an image file.") else: image_path = uploaded_files[0] # Assuming only one image is uploaded
# Step 3: Test the model by providing the uploaded image
generated_text = image_to_text_pipeline(image_path)
# Step 4: Print the generated text
print("Generated Text:", generated_text)