freddyaboulton / gradio-leaderboard

Super fast , batteries included Leaderboard component ⚡️
1 stars 2 forks source link

How to build the Wheel package correctly? #17

Open erumoico opened 3 weeks ago

erumoico commented 3 weeks ago

Hi! I've added a link to my clone of your repository to the requirements.txt file in my Hugging Face Space. But after a successful build, I still only get "Loading...".

When comparing your Wheel package from pypi with the package I created, I found that there are missing *.pyi files and templates/component directory.

Can you please add to the Readme.md file how to build the Wheel package correctly?

freddyaboulton commented 3 weeks ago

Hi @erumoico - the problem is that the svelte files are not compiled if you install from git. You need to run gradio cc build and then install from the wheel located in the dist/ directory.

erumoico commented 3 weeks ago

Unfortunately, the building ended with an error. I found this guide, but unfortunately it didn't help me.

Versions:

python==3.10.14
pip==24.2
nodejs==18.18.2
npm==9.8.1
gradio==4.44.0

What I did:

git clone https://github.com/freddyaboulton/gradio-leaderboard.git
cd gradio-leaderboard
gradio cc build --no-generate-docs
npm i -D @gradio/preview
gradio cc build --no-generate-docs

What I got:

ValueError: Could not find `@gradio/preview`. Run `npm i -D @gradio/preview` in your frontend folder.
freddyaboulton commented 3 weeks ago

Can you try running gradio cc install first before building? The @gradio/preview package must be installed in frontend/

For future reference, that info is documented here: https://www.gradio.app/guides/frequently-asked-questions#do-i-always-need-to-start-my-component-from-scratch

erumoico commented 3 weeks ago

What I got:

ValueError: Could not find `@gradio/preview`. Run `npm i -D @gradio/preview` in your frontend folder.

Ah, the frontend folder, now I know what I did wrong…

erumoico commented 3 weeks ago

After many failures I decided to downgrade the gradio package to version 4.27.0. With this version my Wheel package was built correctly.

The build does not work since gradio>=4.28.0. https://github.com/gradio-app/gradio/commit/624f9b9477f74a581a6c14119234f9efdfcda398#diff-f8faa751045e0596876335f3fb7e5e46803bc2eb5986577be80f9ad392630ae8

What was enough to do with gradio==4.27.0:

git clone https://github.com/freddyaboulton/gradio-leaderboard.git
cd gradio-leaderboard
gradio cc install
gradio cc build --no-generate-docs