facebookresearch / nougat

Implementation of Nougat Neural Optical Understanding for Academic Documents
https://facebookresearch.github.io/nougat/
MIT License
8.81k stars 561 forks source link

Plain text when calling API #113

Closed Yashar78 closed 1 year ago

Yashar78 commented 1 year ago

If I call the API ( nougatapi) to OCR a pdf and save it to a file and read it back , I see just a plain text, like "and a (1\times 1) pointwise convolution 2(c).\n\nA standard convolutional layer takes as input a (D{F}\times D{F}\times M) feature map (\mathbf{F}) and produces a (D{F}\times D{F}\times N) feature map (\mathbf{G}) where (D{F}) is the spatial width and height of a square input feature map1, (M) is" ,

which if I open it via the VS Code plugin I just see this plain text and no rendering of it. While if I do the same but this time via the nougat cli, then it is perfect and I can see the rendered formulas.

should I convert text to a specific format, which library ?

lukas-blecher commented 1 year ago

how do you save it?

Yashar78 commented 1 year ago

after calling the API : Path(output_file_name).write_text( response.text , encoding="utf-8")

lukas-blecher commented 1 year ago

try instead Path(output_file_name).write_text( response.json() , encoding="utf-8")

Yashar78 commented 1 year ago

It works now . Thanks a lot 👍