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.47k stars 2.53k forks source link

Minified version of Gradio Lite is broken #7776

Open quangIle opened 7 months ago

quangIle commented 7 months ago

Describe the bug

Although the tutorial does not use the minified, jsDelivr's install section uses minified version.

image

Have you searched existing issues? πŸ”Ž

Reproduction

<html>

<head>
  <script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.min.js"></script>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.min.css" />
</head>

<body>
  <gradio-lite>
    import gradio as gr

    def greet(name):
      return "Hello, " + name + "!"

    gr.Interface(greet, "textbox", "textbox").launch()
  </gradio-lite>
</body>

</html>

Screenshot

No response

Logs

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '$$')
    at init$1 (Component.js:130:44)
    at new Blocks (Blocks.svelte:447:31)
    at Array.create_if_block_1$2 (lite.min.js:7:184561)
    at Object.p (lite.min.js:7:186726)
    at update_slot_base (utils.js:203:8)
    at Object.p (lite.min.js:7:127367)
    at update (scheduler.js:119:30)
    at flush$1 (scheduler.js:79:5)

System Info

Chrome browser

Severity

I can work around it

whitphx commented 6 months ago

lite.js is minified after #7852 and jsDeliver skips minification now.

$ wget https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.js
$ wget https://cdn.jsdelivr.net/npm/@gradio/lite/dist/lite.min.js
$ diff lite.js lite.min.js
0a1,6
> /**
>  * Skipped minification because the original files appears to be already minified.
>  * Original file: /npm/@gradio/lite@4.26.0/dist/lite.js
>  *
>  * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
>  */

However, this problem still exists πŸ€” Keep investigation...

abidlabs commented 1 week ago

Is this still an issue?

whitphx commented 1 week ago

Yes it is. btw v5 is not released to npm/jsDeliver yet?