Instructions to use getZuma/image-captioning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use getZuma/image-captioning 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="getZuma/image-captioning")# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("getZuma/image-captioning") model = AutoModelForMultimodalLM.from_pretrained("getZuma/image-captioning", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
eca2bf8
1
Parent(s): 7ab9f15
removed devices
Browse files- handler.py +1 -1
handler.py
CHANGED
|
@@ -8,7 +8,7 @@ from transformers import BlipForConditionalGeneration, BlipProcessor
|
|
| 8 |
import requests
|
| 9 |
from PIL import Image
|
| 10 |
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
| 11 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 12 |
|
| 13 |
class EndpointHandler():
|
| 14 |
def __init__(self, path=""):
|
|
|
|
| 8 |
import requests
|
| 9 |
from PIL import Image
|
| 10 |
from transformers import Blip2Processor, Blip2ForConditionalGeneration
|
| 11 |
+
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
| 12 |
|
| 13 |
class EndpointHandler():
|
| 14 |
def __init__(self, path=""):
|