Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SyntaxError: Cannot use import statement outside a module #4

Open
Lorh-o opened this issue Apr 13, 2024 · 1 comment
Open

SyntaxError: Cannot use import statement outside a module #4

Lorh-o opened this issue Apr 13, 2024 · 1 comment

Comments

@Lorh-o
Copy link

Lorh-o commented Apr 13, 2024

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();
};

@melMass
Copy link

melMass commented Apr 13, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants