fix: remove unused httpx (#919)
* remove unused httpx Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> * use requests instead of httpx Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> * remove more usage of httpx Signed-off-by: Michele Dolfi <dol@zurich.ibm.com> --------- Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
parent
4cc6e3ea5e
commit
c18f47c5c0
@ -4,9 +4,7 @@ import zipfile
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Iterable, List, Optional
|
from typing import Iterable, List, Optional
|
||||||
|
|
||||||
import httpx
|
|
||||||
import numpy
|
import numpy
|
||||||
import torch
|
|
||||||
from docling_core.types.doc import BoundingBox, CoordOrigin
|
from docling_core.types.doc import BoundingBox, CoordOrigin
|
||||||
|
|
||||||
from docling.datamodel.base_models import Cell, OcrCell, Page
|
from docling.datamodel.base_models import Cell, OcrCell, Page
|
||||||
|
@ -3,11 +3,7 @@ import io
|
|||||||
import logging
|
import logging
|
||||||
from typing import Iterable, List, Optional
|
from typing import Iterable, List, Optional
|
||||||
|
|
||||||
import httpx
|
import requests
|
||||||
from docling_core.types.doc import PictureItem
|
|
||||||
from docling_core.types.doc.document import ( # TODO: move import to docling_core.types.doc
|
|
||||||
PictureDescriptionData,
|
|
||||||
)
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from pydantic import BaseModel, ConfigDict
|
from pydantic import BaseModel, ConfigDict
|
||||||
|
|
||||||
@ -90,13 +86,13 @@ class PictureDescriptionApiModel(PictureDescriptionBaseModel):
|
|||||||
**self.options.params,
|
**self.options.params,
|
||||||
}
|
}
|
||||||
|
|
||||||
r = httpx.post(
|
r = requests.post(
|
||||||
str(self.options.url),
|
str(self.options.url),
|
||||||
headers=self.options.headers,
|
headers=self.options.headers,
|
||||||
json=payload,
|
json=payload,
|
||||||
timeout=self.options.timeout,
|
timeout=self.options.timeout,
|
||||||
)
|
)
|
||||||
if not r.is_success:
|
if not r.ok:
|
||||||
_log.error(f"Error calling the API. Reponse was {r.text}")
|
_log.error(f"Error calling the API. Reponse was {r.text}")
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user