doctr icon indicating copy to clipboard operation
doctr copied to clipboard

[api] Add support of PDF / multi-image inputs in the API template

Open fg-mindee opened this issue 3 years ago • 16 comments

Currently, as specified in #609, the API template only supports single image input. With the latest version of docTR, it would be quite easy to change this to support PDF and multiple image inputs.

fg-mindee avatar Nov 12 '21 13:11 fg-mindee

Hey, can I start off working on this in case no one has ?

SkaarFacee avatar Dec 11 '23 15:12 SkaarFacee

Hey, can I start off working on this in case no one has ?

Sure :)

felixdittrich92 avatar Dec 23 '23 12:12 felixdittrich92

@nikokks Still on it ? :)

felixdittrich92 avatar Feb 09 '24 08:02 felixdittrich92

I apologize for the delay in responding to your request. Due to prior commitments, I was unable to attend to this matter sooner.

When attempting to install the required packages, I encountered an issue with the version dependency constraints of tensorflow-macos. This incompatibility prevented the installation of other essential Python packages. Has anyone else come across the issue ?

Fixes I have tried:

  • Removing the version constraint for tf in the requirements file
  • Changing python to version 3.8 and 3.9

SkaarFacee avatar Feb 13 '24 04:02 SkaarFacee

Just adding the initial error message for reference here

ERROR: Could not find a version that satisfies the requirement tensorflow==2.12.0 (from versions: 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1, 2.14.0rc0, 2.14.0rc1, 2.14.0, 2.14.1, 2.15.0rc0, 2.15.0rc1, 2.15.0)
ERROR: No matching distribution found for tensorflow==2.12.0

SkaarFacee avatar Feb 13 '24 17:02 SkaarFacee

Hey @SkaarFacee 👋

Mh good question ^^ But from the traceback what happens if you pin TensorFlow to 2.13 or 2.14 or 2.15 ?

felixdittrich92 avatar Feb 13 '24 18:02 felixdittrich92

Hey @felixdittrich92 :) When I try TensorFlow 2.13, I get conflicting dependencies. I tried with Tensorflow 2.14 as it had smaller amount of conflicting dependencies. That worked perfectly fine.

Thanks :)

SkaarFacee avatar Feb 13 '24 19:02 SkaarFacee

Hey @felixdittrich92 :) When I try TensorFlow 2.13, I get conflicting dependencies. I tried with Tensorflow 2.14 as it had smaller amount of conflicting dependencies. That worked perfectly fine.

Thanks :)

Mh crazy 😅 Unfortunately i can't test it without a Mac.. but nice that it works now 😊

felixdittrich92 avatar Feb 13 '24 19:02 felixdittrich92

I came across another issue 😢 While trying run the api locally with the command

uvicorn --reload --workers 1 --host 0.0.0.0 --port=8002 --app-dir api/ app.main:app

I get the error saying

File "/Users/adi/Skaarfacee/doctr/api/app/config.py", line 8, in <module>
    import doctr
ModuleNotFoundError: No module named 'doctr

When I try importing doctr in my virtual env, it does get imported successfully

SkaarFacee avatar Feb 13 '24 19:02 SkaarFacee

Mhh...

cd doctr/api
uvicorn app.main:app --reload --workers 1 --host 0.0.0.0 --port 8080

Does not work ?

felixdittrich92 avatar Feb 14 '24 07:02 felixdittrich92

I'll give that a try and report back on the results. While I remember trying that and then encountering an error before, I'm not entirely clear on the specific details of the error. I'll do my best to investigate further and provide an update as soon as possible.

SkaarFacee avatar Feb 15 '24 04:02 SkaarFacee

Hey @felixdittrich92, I did try running the command and it led to the same error :/

SkaarFacee avatar Feb 19 '24 05:02 SkaarFacee

Hey, I am still stuck with this error. reinstalling the virtual env and that did not help the issue either

SkaarFacee avatar Feb 25 '24 08:02 SkaarFacee

Hey @SkaarFacee :wave:,

Sry for the late response, but if you run it as described in https://github.com/mindee/doctr/blob/main/api/README.md it runs without issues ?

felixdittrich92 avatar Feb 25 '24 11:02 felixdittrich92

Yes, I did try that, I did create the environment using conda and then used pip. Could that be the problem ? I used anaconda to switch between python versions easily

SkaarFacee avatar Feb 26 '24 18:02 SkaarFacee

Hey @SkaarFacee :wave:

pip on conda works fine but check that you use the correct env if you start the api (If you use VSCode you can also see which interpreter is used (with conda it shows also which env is used)

conda list python-doctr
python3 ...

felixdittrich92 avatar Feb 27 '24 07:02 felixdittrich92