Skip to content

Change Hardcoded Image Save Path to Support Parallel Processing #7

Description

@codechrl

Description:
Currently, the image_save_path is hardcoded as:

image_save_path = f"imgs/saved_image_demo.png"

This causes issues when handling multiple API requests simultaneously, as the file gets overwritten. To support parallel processing, I propose changing it to:

import uuid

def generate_uuid():
    return str(uuid.uuid4())

image_save_path = f"imgs/{generate_uuid()}.png"

Proposed Solution:
Modify the save path to use generate_uuid() to ensure unique filenames for each request.
This will prevent file conflicts and allow the API to process multiple requests concurrently.

Impact:
Improves API reliability in multi-request scenarios.
Prevents data loss due to file overwrites.

Let me know if any additional considerations are needed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions