comfy-ui-client icon indicating copy to clipboard operation
comfy-ui-client copied to clipboard

SyntaxError: Cannot use import statement outside a module

Open Lorh-o opened this issue 1 year ago • 1 comments

Not sure why this is happening, using the examples..

import { v4 as uuidv4 } from 'uuid';

import { ComfyUIClient } from 'comfy-ui-client'; import type { Prompt } from 'comfy-ui-client';

// The ComfyUI server address const SERVER_ADDRESS = '127.0.0.1:8188';

export const txt2img = async ( prompt: Prompt, outputDir: string, ): Promise => { // Create client ID const clientId = uuidv4();

// Create client const client = new ComfyUIClient(SERVER_ADDRESS, clientId);

// Connect to server await client.connect();

// Get images const images = await client.getImages(prompt);

// Save images to file await client.saveImages(images, outputDir);

// Disconnect await client.disconnect(); };

Lorh-o avatar Apr 13 '24 21:04 Lorh-o

This is a full working demo around the code you provided. It's not an issue with this library. client_demo.zip

melMass avatar Apr 13 '24 22:04 melMass