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 ·
e454733
1
Parent(s): 7c90bcf
Updated handler file
Browse files- handler.py +5 -2
handler.py
CHANGED
|
@@ -38,9 +38,12 @@ class EndpointHandler():
|
|
| 38 |
A :obj:`dict`:. The object returned should be a dict of one list like {"captions": ["A hugging face at the office"]} containing :
|
| 39 |
- "caption": A string corresponding to the generated caption.
|
| 40 |
"""
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
prompt = data.pop("prompt", None)
|
| 43 |
-
|
|
|
|
| 44 |
|
| 45 |
if isinstance(img_data, Image.Image):
|
| 46 |
raw_image = img_data
|
|
|
|
| 38 |
A :obj:`dict`:. The object returned should be a dict of one list like {"captions": ["A hugging face at the office"]} containing :
|
| 39 |
- "caption": A string corresponding to the generated caption.
|
| 40 |
"""
|
| 41 |
+
print("********* Helllo ***********")
|
| 42 |
+
print(data)
|
| 43 |
+
img_data = data.pop("input", data)
|
| 44 |
prompt = data.pop("prompt", None)
|
| 45 |
+
print("#########")
|
| 46 |
+
# parameters = data.pop("parameters", {})
|
| 47 |
|
| 48 |
if isinstance(img_data, Image.Image):
|
| 49 |
raw_image = img_data
|