[PR #20911] [MERGED] perf: parallelize image loading in image_edits endpoint #64682

Closed
opened 2026-05-06 10:19:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/20911
Author: @sjhddh
Created: 1/23/2026
Status: Merged
Merged: 1/27/2026
Merged by: @tjbck

Base: devHead: fix/images-parallel-loading


📝 Commits (1)

  • 79486b6 perf: parallelize image loading in image_edits endpoint

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 backend/open_webui/routers/images.py (+2 -1)

📄 Description

Summary

Use asyncio.gather() to load multiple images concurrently in the image_edits endpoint instead of loading them sequentially.

Problem

When editing multiple images, the current implementation loads them one by one:

form_data.image = [await load_url_image(img) for img in form_data.image]

This means if you have 5 images that each take 1 second to load, the total time is 5 seconds.

Solution

Use asyncio.gather() to load all images in parallel:

form_data.image = list(await asyncio.gather(*[load_url_image(img) for img in form_data.image]))

With this change, all 5 images load concurrently, reducing total time to ~1 second.

Changed

  • Image loading in image_edits endpoint now uses asyncio.gather() for parallel execution

Fixed

  • Sequential image loading causing unnecessary latency in multi-image edit operations

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/20911 **Author:** [@sjhddh](https://github.com/sjhddh) **Created:** 1/23/2026 **Status:** ✅ Merged **Merged:** 1/27/2026 **Merged by:** [@tjbck](https://github.com/tjbck) **Base:** `dev` ← **Head:** `fix/images-parallel-loading` --- ### 📝 Commits (1) - [`79486b6`](https://github.com/open-webui/open-webui/commit/79486b64c5c498656a43d40865e1a330eb61e247) perf: parallelize image loading in image_edits endpoint ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/images.py` (+2 -1) </details> ### 📄 Description ## Summary Use `asyncio.gather()` to load multiple images concurrently in the `image_edits` endpoint instead of loading them sequentially. ## Problem When editing multiple images, the current implementation loads them one by one: ```python form_data.image = [await load_url_image(img) for img in form_data.image] ``` This means if you have 5 images that each take 1 second to load, the total time is 5 seconds. ## Solution Use `asyncio.gather()` to load all images in parallel: ```python form_data.image = list(await asyncio.gather(*[load_url_image(img) for img in form_data.image])) ``` With this change, all 5 images load concurrently, reducing total time to ~1 second. ### Changed - Image loading in `image_edits` endpoint now uses `asyncio.gather()` for parallel execution ### Fixed - Sequential image loading causing unnecessary latency in multi-image edit operations --- ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](https://github.com/open-webui/open-webui/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-06 10:19:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#64682