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

Add image upload and delete endpoints in server.py #6277

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

pupba
Copy link

@pupba pupba commented Dec 30, 2024

Description

This pull request introduces new endpoints in server.py for uploading images in byte stream format and for deleting files.

Changes Made

  • Added an endpoint for uploading images: POST /upload/image_stream
  • Added an endpoint for deleting files: DELETE /delete-file

Notes

Please review the changes and let me know if any modifications are needed.

Add image upload and delete endpoints in server.py

### Description
This pull request introduces new endpoints in `server.py` for uploading images in byte stream format and for deleting files.

### Changes Made
- Added an endpoint for uploading images: `POST /upload/image_stream`
- Added an endpoint for deleting files: `DELETE /delete-file`

### Notes
Please review the changes and let me know if any modifications are needed.
@ltdrdata
Copy link
Collaborator

I believe that functions like “delete file” should only be permitted through an extension and should not exist as a core endpoint.

@pupba
Copy link
Author

pupba commented Dec 30, 2024

@ltdrdata
I understand.

I thought it would be necessary to have a feature to use and remove images uploaded when using the API, so I created it.

I guess I need to remake it as an extension.

For now, I will exclude this part and try to submit the PR again.

Thank you for the good suggestion.

@ltdrdata
Copy link
Collaborator

ltdrdata commented Dec 30, 2024

What is the reason for trying to send via byte stream instead of websocket?

https://github.com/comfyanonymous/ComfyUI/blob/master/custom_nodes/websocket_image_save.py
https://github.com/comfyanonymous/ComfyUI/blob/master/script_examples/websockets_api_example_ws_images.py

@pupba
Copy link
Author

pupba commented Dec 30, 2024

In the project I am working on, multiple users need to receive results through the Image-text-to-Image process, and they have to upload different images each time. Since users upload images and execute workflows only when needed, I believe there is no reason to bear the overhead of WebSocket connections. Therefore, using a byte stream can be more efficient for handling the frequent and varied image uploads, as it allows for simpler and potentially faster data transmission without the overhead of maintaining a WebSocket connection.

server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
@pupba pupba requested a review from bigcat88 January 2, 2025 00:22
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.

3 participants