cnmoro / nano-image-captioning

huggingface.co
Total runs: 66
24-hour runs: 2
7-day runs: 16
30-day runs: 46
Model's Last Updated: January 29 2025
image-to-text

Introduction of nano-image-captioning

Model Details of nano-image-captioning

An image captioning model, based on bert-tiny and vit-tiny, weighing only 40mb!

Works very fast on CPU.

from transformers import AutoTokenizer, AutoImageProcessor, VisionEncoderDecoderModel
import requests, time
from PIL import Image

model_path = "cnmoro/nano-image-captioning"

# load the image captioning model and corresponding tokenizer and image processor
model = VisionEncoderDecoderModel.from_pretrained(model_path)
tokenizer = AutoTokenizer.from_pretrained(model_path)
image_processor = AutoImageProcessor.from_pretrained(model_path)

# preprocess an image
url = "https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/New_york_times_square-terabass.jpg/800px-New_york_times_square-terabass.jpg"
image = Image.open(requests.get(url, stream=True).raw)
pixel_values = image_processor(image, return_tensors="pt").pixel_values

start = time.time()

# generate caption - suggested settings
generated_ids = model.generate(
    pixel_values,
    temperature=0.7,
    top_p=0.8,
    top_k=50,
    num_beams=3 # you can use 1 for even faster inference with a small drop in quality
)
generated_text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]

end = time.time()

print(generated_text)
# a group of people are in the middle of a city.

print(f"Time taken: {end - start} seconds")
# Time taken: 0.07550048828125 seconds
# on CPU !

Runs of cnmoro nano-image-captioning on huggingface.co

66
Total runs
2
24-hour runs
3
3-day runs
16
7-day runs
46
30-day runs

More Information About nano-image-captioning huggingface.co Model

More nano-image-captioning license Visit here:

https://choosealicense.com/licenses/apache-2.0

nano-image-captioning huggingface.co

nano-image-captioning huggingface.co is an AI model on huggingface.co that provides nano-image-captioning's model effect (), which can be used instantly with this cnmoro nano-image-captioning model. huggingface.co supports a free trial of the nano-image-captioning model, and also provides paid use of the nano-image-captioning. Support call nano-image-captioning model through api, including Node.js, Python, http.

nano-image-captioning huggingface.co Url

https://huggingface.co/cnmoro/nano-image-captioning

cnmoro nano-image-captioning online free

nano-image-captioning huggingface.co is an online trial and call api platform, which integrates nano-image-captioning's modeling effects, including api services, and provides a free online trial of nano-image-captioning, you can try nano-image-captioning online for free by clicking the link below.

cnmoro nano-image-captioning online free url in huggingface.co:

https://huggingface.co/cnmoro/nano-image-captioning

nano-image-captioning install

nano-image-captioning is an open source model from GitHub that offers a free installation service, and any user can find nano-image-captioning on GitHub to install. At the same time, huggingface.co provides the effect of nano-image-captioning install, users can directly use nano-image-captioning installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

nano-image-captioning install url in huggingface.co:

https://huggingface.co/cnmoro/nano-image-captioning

Url of nano-image-captioning

nano-image-captioning huggingface.co Url

Provider of nano-image-captioning huggingface.co

cnmoro
ORGANIZATIONS

Other API from cnmoro

huggingface.co

Total runs: 41
Run Growth: 10
Growth Rate: 24.39%
Updated:April 09 2026
huggingface.co

Total runs: 4
Run Growth: -3
Growth Rate: -75.00%
Updated:January 14 2025