Skip to content

Commit

Permalink
fix: remove unused httpx (#919)
Browse files Browse the repository at this point in the history
* remove unused httpx

Signed-off-by: Michele Dolfi <[email protected]>

* use requests instead of httpx

Signed-off-by: Michele Dolfi <[email protected]>

* remove more usage of httpx

Signed-off-by: Michele Dolfi <[email protected]>

---------

Signed-off-by: Michele Dolfi <[email protected]>
  • Loading branch information
dolfim-ibm authored Feb 7, 2025
1 parent 4cc6e3e commit c18f47c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 0 additions & 2 deletions docling/models/easyocr_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
from pathlib import Path
from typing import Iterable, List, Optional

import httpx
import numpy
import torch
from docling_core.types.doc import BoundingBox, CoordOrigin

from docling.datamodel.base_models import Cell, OcrCell, Page
Expand Down
10 changes: 3 additions & 7 deletions docling/models/picture_description_api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
import logging
from typing import Iterable, List, Optional

import httpx
from docling_core.types.doc import PictureItem
from docling_core.types.doc.document import ( # TODO: move import to docling_core.types.doc
PictureDescriptionData,
)
import requests
from PIL import Image
from pydantic import BaseModel, ConfigDict

Expand Down Expand Up @@ -90,13 +86,13 @@ def _annotate_images(self, images: Iterable[Image.Image]) -> Iterable[str]:
**self.options.params,
}

r = httpx.post(
r = requests.post(
str(self.options.url),
headers=self.options.headers,
json=payload,
timeout=self.options.timeout,
)
if not r.is_success:
if not r.ok:
_log.error(f"Error calling the API. Reponse was {r.text}")
r.raise_for_status()

Expand Down

0 comments on commit c18f47c

Please sign in to comment.