Mika Scraper / imageToPrompt
Function: imageToPrompt()
imageToPrompt(
options
):Promise
<NeuralFramesResponse
>
Defined in: src/_other-scraper/imagetoprompt.ts:28
Uploads an image (either from a URL or a raw Buffer) to the NeuralFramesβ CLIP Interrogate endpoint, returning an AI-generated textual prompt.
Parameters
options
ImageToPromptOptions
An object containing the input options to specify the image source, which can either be a URL or a Buffer.
Returns
Promise
<NeuralFramesResponse
>
A promise that resolves to the AI-generated prompt represented by a NeuralFramesResponse
object.
Throws
Error
An error is thrown if both input types are missing or if the API call fails due to network issues or invalid API response.
Example
import { imageToPrompt } from 'mika-scraper';
// Usage example with a URL
imageToPrompt({ url: 'https://example.com/image.jpg' })
.then(response => {
console.log('Generated Prompt:', response.prompt);
})
.catch(error => {
console.error('Error:', error);
});
Last updated on