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
31.7k stars 2.36k forks source link

Should the gradio client build in a default create-react-app out of the box? #7693

Open lsb opened 5 months ago

lsb commented 5 months ago

Describe the bug

Not sure to file this as a bug or a feature request.

When adding the javascript gradio client, and doing the import { client } from '@gradio/client', to a stock React app, there are lots of build errors with unmet polyfills, like stream, net, tls, buffer, crypto, zlib, zlib_bindings, and more.

It looks like the client is doing interesting things with streaming requests and crypto and such.

I wanted to use the gradio client because I thought I'd read somewhere that the HF spaces with gradio had some queueing logic that the client took care of, and that a Gradio space wasn't just a simple HTTP call for inference.

Should I be able to use the gradio client in a create-react-app app out of the box?

Thanks!

Have you searched existing issues? 🔎

Reproduction


npx create-react-app gradio-cra-test
cd gradio-cra-test
npm i @gradio/client
echo "import { client } from '@gradio/client'" >> src/App.js
npm run build

Screenshot

No response

Logs

No response

System Info

@gradio/client v0.13.0
node v20.11.1 (lts)
npm 10.2.4
react 18.2.0

Severity

Blocking usage of gradio

pngwn commented 5 months ago

Do you know what bundler cra uses currently?

We are working on the client atm, so I'll add this as a new test case.

lsb commented 5 months ago

CRA uses webpack 5

marwanelzainy commented 2 months ago

Any news on this? Is there a workaround for now?

pngwn commented 2 months ago

Working on it at the minute. Should be addressed shortly.