init
commit
2712a026ab
|
@ -0,0 +1 @@
|
|||
MOON_DREAM_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJrZXlfaWQ
|
|
@ -0,0 +1,2 @@
|
|||
.env
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
FROM python:3.10-slim
|
||||
|
||||
# Environment setup
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# System dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
build-essential \
|
||||
libjpeg-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the app code and image
|
||||
COPY . .
|
||||
|
||||
# Set the entrypoint
|
||||
CMD ["python", "start_moondream.py"]
|
|
@ -0,0 +1,4 @@
|
|||
moondream
|
||||
Pillow
|
||||
python-dotenv
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
import os
|
||||
from dotenv import load_dotenv
|
||||
import moondream as md
|
||||
from PIL import Image
|
||||
|
||||
# Load .env
|
||||
load_dotenv()
|
||||
|
||||
# Get key from env
|
||||
api_key = os.getenv("MOON_DREAM_KEY")
|
||||
|
||||
# Use Moondream cloud model
|
||||
model = md.vl(api_key=api_key)
|
||||
|
||||
# Load image
|
||||
image = Image.open("nat.jpg")
|
||||
|
||||
# Generate caption
|
||||
caption_response = model.caption(image, length="short")
|
||||
print(caption_response["caption"])
|
Loading…
Reference in New Issue