gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
33.72k stars 2.56k forks source link

Node js support for the JS client #3495

Closed jakiestfu closed 1 year ago

jakiestfu commented 1 year ago

Is your feature request related to a problem? Please describe.
I would like to be able to leverage the gradio client in my nodejs server to run inference on a private gradio api.

Describe the solution you'd like

Additional context
I've made these changes to the gradio client locally and it works like a charm. If ya'll are interested, I can pose a PR.

abidlabs commented 1 year ago

Thanks @jakiestfu for creating this issue, cc-ing @pngwn -- does this relate to the Gradio JS client you've been working on?

jakiestfu commented 1 year ago

In some ways there is a little bit of overlap with #3404 which I can support as well with my pull request.

pngwn commented 1 year ago

We don't want any PRs against the client just yet. Any changes would have no impact as the library is not released yet. We'll consider this use-case as we prepare for release.

Renaming the issue for clarity.

jakiestfu commented 1 year ago

Thats unfortunate to hear, @pngwn but I understand. Is there a timeline for release of the client?

pngwn commented 1 year ago

Very soon!

logesh2496 commented 1 year ago

Hi @pngwn , I'm trying to use the @gradio/client in nodejs but getting the "fetch is not defined" error.

Is there any sample code available on how to install the @gradio/client package in nodejs?

abidlabs commented 1 year ago

As described here, all you should need to do is:

npm i @gradio/client
logesh2496 commented 1 year ago

its js client and only works in browsers. I'm looking for the nodejs example. If we run the client on nodejs you get the below error:

ReferenceError: fetch is not defined
    at file:///Users/logeshrajappa/work/music-gen-api/node_modules/@gradio/client/dist/index.js:731:70
ms502040 commented 11 months ago

Is there any gradio client working without browser? I need pure nodejs implementation too. thx.

pngwn commented 11 months ago

@logesh2496 You need to update your node version to 18+. However there is another issue affecting the javascript gradio client in 4.0. This will be addressed shortly.

jpaquim commented 9 months ago

@pngwn any news on this issue? I'm getting errors when trying to run the client in Node.js (standard SvelteKit application, in a form action endpoint), I assume this is the issue you previously mentioned? ReferenceError: EventSource is not defined I guess I can try a polyfill for EventSource, but I'm not sure I won't run into other issues later on.

AXLShorts commented 6 months ago

Any development on this issue?

pngwn commented 6 months ago

There is a PR open for this atm. Should be released soon!