Skip to content

ComfyUI workflow for 2 images#38

Open
evahteev wants to merge 5 commits intomainfrom
comfyui_workflow_for_2_images
Open

ComfyUI workflow for 2 images#38
evahteev wants to merge 5 commits intomainfrom
comfyui_workflow_for_2_images

Conversation

@evahteev
Copy link

This PR introduces a new class, ImageGenerator, designed to asynchronously generate images using a server-side model. The images are generated based on input prompts, which are provided via a JSON file. The class handles the communication with the server through WebSocket connections, processes the generated images, and uploads them to an S3 bucket. The process involves the following key steps:

Loading and Queuing Prompts:

Prompts are loaded from a specified JSON file.
The prompts are queued for execution on the server, where they are processed asynchronously.
Asynchronous Image Retrieval:

The class listens for image data sent from the server via WebSocket.
The image data is retrieved in real-time, ensuring efficient handling of image generation tasks.
S3 Upload Integration:

The first generated image is uploaded to an S3 bucket using the upload_file_to_s3_binary utility.
The S3 URL of the uploaded image is returned, allowing easy access to the generated image.
Key Features:
Asynchronous Processing: Utilizes asyncio to handle WebSocket communication and image processing concurrently, ensuring non-blocking execution.
WebSocket Communication: Establishes a WebSocket connection to receive real-time updates and images from the server.
Dynamic Prompt Handling: Allows dynamic modification of image URLs within the prompt before sending it to the server.
S3 Upload Capability: Automatically uploads the generated image to an S3 bucket and returns the accessible URL.
Usage Example:
A sample usage has been included in the code, demonstrating how to instantiate the ImageGenerator class, queue a prompt, generate an image, and upload it to S3.

Next Steps:

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

Successfully merging this pull request may close these issues.

1 participant