Instructions to use movementso/blip-image-captioning-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use movementso/blip-image-captioning-large with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # pip install "transformers<5.0.0" from transformers import pipeline pipe = pipeline("image-to-text", model="movementso/blip-image-captioning-large")# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("movementso/blip-image-captioning-large") model = AutoModelForMultimodalLM.from_pretrained("movementso/blip-image-captioning-large", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download test.py from movementso/blip-image-captioning-large: direct link, hf CLI and curl.
- Browser
- Download file 546 Bytes
-
https://huggingface.co/movementso/blip-image-captioning-large/resolve/main/test.py
- Command line
-
hf download hf://movementso/blip-image-captioning-large/test.py
-
curl -L -o test.py https://huggingface.co/movementso/blip-image-captioning-large/resolve/main/test.py
546 Bytes
| from handler import EndpointHandler | |
| # Initialize handler | |
| my_handler = EndpointHandler() | |
| # Prepare sample payload | |
| sample_payload = { | |
| "image_url": "https://fitter-app.imgix.net/https%3A%2F%2Ffitter-uploads-prod.s3.ap-southeast-2.amazonaws.com%2Fuploads%2F2%2F24fe70d4-ec4e-4d3c-bae5-fc8ac689ee3f.jpg?ixlib=rb-4.0.0&fit=crop&fm=png&auto=compress&w=1080&h=720&crop=focalpoint&fp-x=0.5&fp-y=0.5&fp-z=1.0&s=6664946657e1f7325c08aa5d89978470" # Replace with a real image URL | |
| } | |
| # Test the handler | |
| result = my_handler(sample_payload) | |
| print(result) | |