Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add IP option in local inference #29

Open
mariokhz opened this issue Oct 18, 2024 · 4 comments
Open

[Feature] Add IP option in local inference #29

mariokhz opened this issue Oct 18, 2024 · 4 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@mariokhz
Copy link

mariokhz commented Oct 18, 2024

I have a fedora "server" with a NVidia GPU, and I use it for some stuff, like Obsidian Sync, Discord bots, etc.

I'd love the option to run latex-ocr-server in my server and connect to my server IP instead of running it locally in my work laptop (which is not really powerful). So, instead of giving it the python path for running the server and connecting to it, you would give the IP to connect.

Thank you! :)

@lucasvanmol
Copy link
Owner

Hi, that sounds like a really good idea, that could integrate well with the plugin. Unfortunately I don't have much time to develop something like this at the moment (maybe in a couple of weeks I could take a stab at it).

I'd definitely be open to pull requests for this, though. Probably the best way would be to have models/local_model.ts support using strings other than localhost here:

async load() {
        // RPC Client
        console.log(`latex_ocr: initializing RPC client at port ${this.plugin_settings.port}`)
        this.client = new LatexOCRClient(`localhost:${this.plugin_settings.port}`, grpc.credentials.createInsecure())

        // LatexOCR Python Server
        if (this.plugin_settings.startServerOnLoad) {
            this.startServer()
        }
    }

and then don't do any of the spawnServer stuff. You'd probably want to add a setting in settings.ts to be able to supply the url too, if you don't want to run on localhost.

@lucasvanmol lucasvanmol added enhancement New feature or request good first issue Good for newcomers labels Oct 18, 2024
@mariokhz
Copy link
Author

Hi! Thanks for your reply! I've added a setting to write a URL, and I could connect to my server. Unfortunately, as the generatelatex function uses an image filepath string, my server can't find the image.

I don't know how to figure this out; maybe adding sftp://hostname could work for me, but even then it would be too specific.

@lucasvanmol
Copy link
Owner

Thanks for trying this out!

It looks like latex-ocr-server would need an update to allow for passing in an image as bytes as well, meaning the protobuf would need to be updated, which could pretty much just be the existing function. Sorry, the docs here are a bit lacking and I'm in the middle of exams right now so I won't have much time to properly look into this until November.

@mariokhz
Copy link
Author

mariokhz commented Oct 20, 2024

Buenas otra vez, Lucas :)

I can't compile the .proto in neither Python nor TypeScript. I will read the protobuf docs, and maybe I find out how. For now, if I try to compile it myself, I end up with import issues in both Python Server side and building the Obsidian Plugin.
I've never done something like this, but I'd really love to have this feature.

For the .proto, the change is small
message LatexRequest { string image_path = 1; }
to
message LatexRequest { bytes image_bytes = 1; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants