Quick Start
Select your deployment environment
Environment Choose your deployment method | |
---|---|
Cloud API | Local Deployment |
Get Your API Key
Visit console.moondream.ai to create an account and get your API key.
Installation Script
# Install dependencies in your project directory # pip install moondream import moondream as md from PIL import Image # Initialize with API key model = md.vl(api_key="your-api-key") # Load an image image = Image.open("./path/to/image.jpg") encoded_image = model.encode_image(image) # Encode image (recommended for multiple operations) # Generate a caption (length options: "short" or "normal" (default)) caption = model.caption(encoded_image)["caption"] print("Caption:", caption) # Stream the caption for chunk in model.caption(encoded_image, stream=True)["caption"]: print(chunk, end="", flush=True) # Ask a question answer = model.query(encoded_image, "What's in this image?")["answer"] print("Answer:", answer) # Stream the answer for chunk in model.query(encoded_image, "What's in this image?", stream=True)["answer"]: print(chunk, end="", flush=True) # Detect objects detect_result = model.detect(image, 'subject') # change 'subject' to what you want to detect print("Detected objects:", detect_result["objects"]) # Point at an object point_result = model.point(image, 'subject') # change 'subject' to what you want to point at print("Points:", point_result["points"])
Explore Our Cloud Endpoints
💬
/query
Ask natural language questions about images and receive detailed answers
Learn more→
📝
/caption
Generate accurate and natural image captions
Learn more→
🔍
/detect
Detect and locate objects in images
Learn more→
📍
/point
Get precise coordinate locations for objects in images
Learn more→