Algorithms | image magik commands | llama | Search

llama vision

llama vision

This JavaScript code implements a large language model using the node-llama-cpp library, providing functions to initialize and interact with the model. It includes functions for initializing chat sessions, loading LLM models, and analyzing prompts, with optional error handling.

analyze image with llm

This code defines an async function named analyzeImage that takes an image path, reads the image file, converts it to base64, and uses a Large Language Model (LLM) to analyze the image, returning the result.

llm deceive

The llmDeceive function generates a response to a given prompt using an LLaMA model, initializing a session with a specific configuration and session settings. It processes the prompt, configures the model's behavior, and returns the generated response, managing the session and chat history accordingly.

Cell 3

The llmVoice function generates text-to-speech output using the LLaMA model, taking a prompt and optional session object as parameters. It sends the prompt to the model, returning the generated result and resetting the chat history if the provided session is the same as the current session.

Cell 4

The code imports necessary modules, sets the HOMEPATH variable, configures a TTS model, and defines a generateSpeech function to synthesize speech from a prompt and save it to a file. The generateSpeech function is then exported as the default export of the module.

llm voice

The code imports the OuteTTS library, configures a text-to-speech model, and defines a function llmSpeech to convert text to speech, which is then exposed to be used outside of this code module.

Cell 6

The code consists of imported modules, functions, and notes for an asynchronous Python script that uses custom modules browser_use and langchain_ollama to execute a search task on the r/LocalLLaMA subreddit. The script defines two asynchronous functions: run_search() and main().

ollama vision request

Makes a request to the LLaMA Vision API with an optional image and prompt, returning the response message from the API. The function uses async/await syntax and assumes the LLaMA Vision API is running on http://localhost:11434/api/chat.

start a bunch of llm rpc services

The code imports Node.js modules, defines environment configurations, and exports a function launchChats that launches chat services using Node.js. The function loops through the environment configurations and uses child_process to run a new Node.js process for each configuration.

stable diffusion request

The code requires modules for file operations and HTTP requests, defines a constant for the output directory path, and includes an asynchronous function doStableRequest to generate an image based on a given prompt. This function makes a POST request to the stable diffusion API, processes the response, and returns an object containing the seed, image buffer, image path, and prompt.

mask image

The doBackgroundMask function is an asynchronous process that takes an image, extracts its base64 representation, applies a background mask using the rembg API, and writes the masked image to a file. It involves file system operations, image processing, and HTTP requests to the rembg API.

inpaint mask

The doInpaintMask function performs inpainting on an image using a provided mask and text prompt, sending a POST request to a local stable diffusion API endpoint.

image 2 image

The code imports modules for interacting with the file system, working with file paths, and making HTTP requests. It defines a function doImage2Image that takes an image and a prompt, processes the image, makes a POST request to generate an image, and returns the seed and generated image.

whisk images

The code imports various modules and functions, then defines an asynchronous function whiskImages that takes four arguments and handles different types of input for its first two arguments, subject and scene.