mirror of
https://github.com/DS4SD/docling.git
synced 2025-12-08 12:48:28 +00:00
fix: extract response from api_image_request in picture description (#2571)
Signed-off-by: Peter El Hachem <peter.el.hachem@ibm.com> Co-authored-by: Peter El Hachem <peter.el.hachem@ibm.com>
This commit is contained in:
@@ -51,7 +51,7 @@ class PictureDescriptionApiModel(PictureDescriptionBaseModel):
|
|||||||
# Note: technically we could make a batch request here,
|
# Note: technically we could make a batch request here,
|
||||||
# but not all APIs will allow for it. For example, vllm won't allow more than 1.
|
# but not all APIs will allow for it. For example, vllm won't allow more than 1.
|
||||||
def _api_request(image):
|
def _api_request(image):
|
||||||
return api_image_request(
|
response, _ = api_image_request(
|
||||||
image=image,
|
image=image,
|
||||||
prompt=self.options.prompt,
|
prompt=self.options.prompt,
|
||||||
url=self.options.url,
|
url=self.options.url,
|
||||||
@@ -60,5 +60,7 @@ class PictureDescriptionApiModel(PictureDescriptionBaseModel):
|
|||||||
**self.options.params,
|
**self.options.params,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
return response
|
||||||
|
|
||||||
with ThreadPoolExecutor(max_workers=self.concurrency) as executor:
|
with ThreadPoolExecutor(max_workers=self.concurrency) as executor:
|
||||||
yield from executor.map(_api_request, images)
|
yield from executor.map(_api_request, images)
|
||||||
|
|||||||
Reference in New Issue
Block a user