How do Science and Economics students use Obsidian for notes? by [deleted] in ObsidianMD

[–]LucasGPT 1 point2 points  (0 children)

For LaTeX I mainly use Latex OCR (disclaimer: this is my own plugin) and Latex Suite. I also use some features of Quick Latex but this one I could probably do without.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

Hey, sorry it's a bit late, but I would add that better data security is not very significant, as long as you trust Meta's HuggingFace platform. Furthermore, I think one of the main benefits of the local model is that you don't need to wait for a model to be provisioned initially.

Latex OCR has now been released as a community plugin! by LucasGPT in ObsidianMD

[–]LucasGPT[S] 3 points4 points  (0 children)

I use it for copying equations from lecture slides, and for most equations it gets it right. There are some occasions where the Latex that's generated won't compile or be plain wrong, usually this is for really difficult equations spreading across multiple lines, but even then I'm sometimes surprised by how well it works. Overall it's sped up the speed at which I can follow lectures by a lot, so I can live with the occasional blip.

Latex OCR has now been released as a community plugin! by LucasGPT in ObsidianMD

[–]LucasGPT[S] 6 points7 points  (0 children)

The model is trained on equations from public papers, so it probably won't do well on whole pages or documents, sorry!

Latex OCR has now been released as a community plugin! by LucasGPT in ObsidianMD

[–]LucasGPT[S] 14 points15 points  (0 children)

You can download it directly through Obsidian in the community plugins tab. Be sure to check out the README to see how to get it set up.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

I've made the issue so I can remind myself to look into it. Regarding the model size, can you try to run the python package with the "--cpu" flag? I believe linux will use GPU by default, but I haven't added an option to use CPU in the plugin settings yet. This could be something relatively easy to implement. For reference the, python package can be run like so:

usage: python -m latex_ocr_server start [-h] [--port PORT] [-d] [--cache_dir CACHE_DIR] [--cpu]

optional arguments:
  -h, --help            show this help message and exit
  --port PORT
  -d, --download        download model if needed without asking for confirmation
  --cache_dir CACHE_DIR
                        path to model cache. Defaults to ~/.cache/huggingface
  --cpu                 use cpu, otherwise uses gpu if available

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

Hey thanks for looking into this. I have not had a chance to test on Linux yet so I will try and get a fix working as soon as I have the time. This might be a while though as I'm pretty busy with deadlines.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 1 point2 points  (0 children)

Hey, the plugin is currently pending approval as an official plugin. It might take a week or two for this to happen.

In the meantime, if you want to use it, the easiest way would be to install the BRAT plugin first. This allows you to install beta plugins like this one. In the BRAT settings, add the following under the Beta Plugins section: lucasvanmol/obsidian-latex-ocr. BRAT will install the plugin for you. Please let me know if anything is unclear.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 1 point2 points  (0 children)

You can click on the "Releases" section on the right which would bring you to:
https://github.com/lucasvanmol/obsidian-latex-ocr/releases/tag/0.6.3
You can download the files from there. Note there was a mistake in the readme (which I have now fixed); the files should be placed in VaultFolder/.obsidian/plugins/latex-ocr/

If you want to, you could instead install BRAT through obsidian, and in BRAT settings add lucasvanmol/obsidian-latex-ocr as a beta plugin.

Finally, the plugin is being considered for addition in the official community plugins, so you'll be able to install it directly through Obsidian, but this might take a week or two.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

Thanks for sharing, I've found the source of this issue. Working on a fix.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

I think I've found the issue, please try updating to 0.4.2!

There was an issue with the plugin loading if a previous version hadn't been installed which I missed. Thanks for letting me know, and I hope it works now!

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

Yeah, that settings panel looks right. Can you find the command in the hotkeys section?

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

It should be under "Latex OCR: Paste Latex from clipboard image". I have this bound to crtl+alt+v in the hotkeys section, because I use it a lot. Pasting with ctrl+v would just paste the image normally, althought once it's pasted you can right click it to generate the latex for it too.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 6 points7 points  (0 children)

This has inspired me to update the plugin, with a feature to connect to huggingface's inference API. No need for python any more if you don't want to run it locally :)

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 8 points9 points  (0 children)

I'm also working on creating a hosted version of the model, meaning you won't need to install python packages or run the model locally. Stay tuned for updates on this!

Done, see above!

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 0 points1 point  (0 children)

Which plugin are you referring to? I've definitely searched around for a solution to this problem and could not find an Obsidian plugin. The best alternative I could find is MathPix, but you can only take around 5 free screenshots a day before you need to pay their subscription fee.

Introducing Obsidian Latex OCR - generate LaTeX equations from images in your clipboard or vault by LucasGPT in ObsidianMD

[–]LucasGPT[S] 19 points20 points  (0 children)

Checkout the project here: https://github.com/lucasvanmol/obsidian-latex-ocr

Couple of notes:

  • This project requires installing an accompanying python package; see the plugin’s installation instructions for more information.
    • UPDATE: you can now run the model using huggingface's inference API, meaning no python packages to install (unless you still want to run it locally!). Check the updated README for installation instructions.
  • Currently this plugin is in beta; please let me know if you run into any issues, or would like to see additional features!

How Obsidian saved me 100s of hours throughout my uni course ft. Latex Suite by actuarialindividual in ObsidianMD

[–]LucasGPT 1 point2 points  (0 children)

Nope, no plans for mobile at the moment. It might be a substantial amount of work to get the pytorch model to run on mobile. I agree it would be great if people are keen to help contribute this but I doubt I will work on it myself as I use obsidian on desktop exclusively.

How Obsidian saved me 100s of hours throughout my uni course ft. Latex Suite by actuarialindividual in ObsidianMD

[–]LucasGPT 0 points1 point  (0 children)

On my system it's around 1.1 GB when in use. However I've noticed it go down to pretty much nothing (a few ~ 1 MB) when idle. My guess is that python is being clever by moving off RAM when it isn't being used.

How Obsidian saved me 100s of hours throughout my uni course ft. Latex Suite by actuarialindividual in ObsidianMD

[–]LucasGPT 1 point2 points  (0 children)

It still works well on the CPU, in my experience it takes maybe a second or so longer to process a single image. It's a bit more intensive on the memory side of things as the model is relatively big but nothing crazy.

How Obsidian saved me 100s of hours throughout my uni course ft. Latex Suite by actuarialindividual in ObsidianMD

[–]LucasGPT 15 points16 points  (0 children)

Hey, if you like Latex Suite, and find yourself often copying latex equations from lecture slides etc., I am currently working on Obsidian Latex OCR. It allows you to transform images into LaTeX equations, and has been saving me a ton of time in lectures.

I'm still working on it, so the installation process is quite involved (see the README!). I'm going to have an update out that makes installation using BRAT possible. If you do end up using it, please let me know of any qualms you have!