mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-21 04:24:51 +00:00
Fix image edit endpoint (#17046)
* Fix image edit endpoint * Update litellm/proxy/image_endpoints/endpoints.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -215,9 +215,11 @@ async def image_generation(
|
||||
async def image_edit_api(
|
||||
request: Request,
|
||||
fastapi_response: Response,
|
||||
image: List[UploadFile] = File(...),
|
||||
mask: Optional[List[UploadFile]] = File(None),
|
||||
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
|
||||
image: Optional[List[UploadFile]] = File(None),
|
||||
image_array: Optional[List[UploadFile]] = File(None, alias="image[]"),
|
||||
mask: Optional[List[UploadFile]] = File(None),
|
||||
mask_array: Optional[List[UploadFile]] = File(None, alias="mask[]"),
|
||||
model: Optional[str] = None,
|
||||
):
|
||||
"""
|
||||
@@ -233,6 +235,18 @@ async def image_edit_api(
|
||||
-F 'prompt=Create a studio ghibli image of this'
|
||||
```
|
||||
"""
|
||||
if image is not None and image_array is not None:
|
||||
raise HTTPException(status_code=422, detail="Cannot specify both 'image' and 'image[]'")
|
||||
if mask is not None and mask_array is not None:
|
||||
raise HTTPException(status_code=422, detail="Cannot specify both 'mask' and 'mask[]'")
|
||||
if image is None and image_array is not None:
|
||||
image = image_array
|
||||
if mask is None and mask_array is not None:
|
||||
mask = mask_array
|
||||
|
||||
if image is None:
|
||||
raise HTTPException(status_code=422, detail="Field required: image")
|
||||
|
||||
from litellm.proxy.proxy_server import (
|
||||
_read_request_body,
|
||||
general_settings,
|
||||
|
||||
Reference in New Issue
Block a user