harperreed / eyeballs-mqtt

MIT License
1 stars 0 forks source link

Eyeballs - LLaVA (Replicate AI) MQTT API

This project is a Node.js application that listens for MQTT messages containing either a base64 encoded image or an image URL. It then processes the image using the Replicate API and publishes the result back to another MQTT topic.

Meant to be used with the 🌋 LLaVA: Large Language and Vision Assistant hosted at replicate. Could be easily repurposed for other use cases and models.

Features

Requirements

Environment Variables

Copy the .env.example to .env and fill in the following variables:

REPLICATE_API_TOKEN=your_replicate_api_token
TOPIC=input_topic
BROKER_ADDRESS=mqtt://broker_address
MODEL=model_identifier
OUTPUT_TOPIC=output_topic

Setup and Run

Using Node.js

  1. Install dependencies:

    npm install
  2. Run the app:

    node your-app-file.js

Using Docker

  1. Build the Docker image:

    docker-compose up --build

Testing

Publish a message to the topic specified in TOPIC with the following JSON payload:

{
  "imageData": "base64_or_image_url",
  "prompt": "describe this image"
}

Check the published message in OUTPUT_TOPIC and the Winston logs for results and timing info.

TODO