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

Enhance Lite E2E tests and fix a networking problem on Lite #9333

Merged
merged 9 commits into from
Sep 13, 2024

Conversation

whitphx
Copy link
Member

@whitphx whitphx commented Sep 12, 2024

Description

E2E tests to detect some regressions on Lite.

@whitphx whitphx changed the base branch from main to 5.0-dev September 12, 2024 15:03
@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Sep 12, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website building...
Storybook ready! Storybook preview
🦄 Changes detecting...

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/c3f4504c9310e0370ce07705bf29dc0cae52b1d4/gradio-4.44.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@c3f4504c9310e0370ce07705bf29dc0cae52b1d4#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/c3f4504c9310e0370ce07705bf29dc0cae52b1d4/gradio-client-1.6.0-beta.1.tgz

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Sep 12, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio minor
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Enhance Lite E2E tests and fix a networking problem on Lite

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@whitphx whitphx changed the title Lite e2e tests Enhance Lite E2E tests Sep 12, 2024
@whitphx
Copy link
Member Author

whitphx commented Sep 13, 2024

Seems like there has been a problem and the restored test caught it.
Will fix it too in this PR.

@whitphx whitphx changed the title Enhance Lite E2E tests Enhance Lite E2E tests and fix a networking problem on Lite Sep 13, 2024
@whitphx
Copy link
Member Author

whitphx commented Sep 13, 2024

Note: found the following error in the dev console. Will see it and probably push a separate PR.

Index.svelte:21 Uncaught (in promise) TypeError: _modify_stream is not a function
    at proxy.modify_stream_state (Index.svelte:21:3)
    at modify_stream (init.js:209:27)
    at Blocks.svelte:377:11
    at Array.forEach (<anonymous>)
    at handle_status_update (Blocks.svelte:376:20)
    at make_prediction (Blocks.svelte:280:9)

@whitphx whitphx marked this pull request as ready for review September 13, 2024 05:12
@whitphx
Copy link
Member Author

whitphx commented Sep 13, 2024

Memo:
The impl of 05c8b97 caused an error only in the E2E test, while it doesn't in the normal browser usage.
Then changed it to c3f4504.

Will investigate it later, but we can merge PR with the current version.

PythonError: Traceback (most recent call last):
  File "/lib/python3.12/site-packages/httpx/_decoders.py", line 79, in decode
    return self.decompressor.decompress(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
zlib.error: Error -3 while decompressing data: incorrect header check

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<exec>", line 103, in _run_script
  File "<exec>", line 149, in _run_code
  File "run.py", line 8, in <module>
    inputs=gr.Image("https://picsum.photos/300/200", label="InputImage"),
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/component_meta.py", line 171, in wrapper
    return fn(self, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/components/image.py", line 150, in __init__
    super().__init__(
  File "/lib/python3.12/site-packages/gradio/components/base.py", line 389, in __init__
    super().__init__(*args, **kwargs)
  File "/lib/python3.12/site-packages/gradio/component_meta.py", line 171, in wrapper
    return fn(self, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/components/base.py", line 224, in __init__
    self.value = move_files_to_cache(
                 ^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/processing_utils.py", line 541, in move_files_to_cache
    return client_utils.traverse(data, _move_to_cache, client_utils.is_file_obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio_client/utils.py", line 977, in traverse
    return func(json_obj)
           ^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/processing_utils.py", line 515, in _move_to_cache
    temp_file_path = block.move_resource_to_block_cache(payload.path)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/blocks.py", line 341, in move_resource_to_block_cache
    temp_file_path = processing_utils.save_url_to_cache(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/processing_utils.py", line 384, in save_url_to_cache
    url = get_public_url(url)
          ^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/processing_utils.py", line 365, in get_public_url
    google_resolved_ip = resolve_with_google_dns(hostname)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/processing_utils.py", line 324, in resolve_with_google_dns
    response = sync_client.get("https://dns.google/resolve", params={"name": hostname, "type": "A"})
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/httpx/_client.py", line 1066, in get
    return self.request(
           ^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/httpx/_client.py", line 837, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/httpx/_client.py", line 940, in send
    raise exc
  File "/lib/python3.12/site-packages/httpx/_client.py", line 934, in send
    response.read()
  File "/lib/python3.12/site-packages/httpx/_models.py", line 815, in read
    self._content = b"".join(self.iter_bytes())
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/gradio/processing_utils.py", line 64, in iter_bytes
    decoded = decoder.decode(raw_bytes)
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/httpx/_decoders.py", line 81, in decode
    raise DecodingError(str(exc)) from exc
httpx.DecodingError: Error -3 while decompressing data: incorrect header check

    at new_error (https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.js:10:9965)
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[302]:0x16dbfd
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[489]:0x177431
    at _PyEM_TrampolineCall_JS (https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.js:10:125894)
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[1134]:0x1c2eaf
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[3602]:0x2c7c0f
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[2167]:0x20a884
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[1142]:0x1c359c
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[1145]:0x1c38ab
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[1146]:0x1c3929
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[3408]:0x29e95d
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[3409]:0x2a4f54
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[1148]:0x1c3a69
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[1143]:0x1c36d2
    at https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.wasm:wasm-function[476]:0x176a95
    at callPyObjectKwargs (https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.js:10:64068)
    at Module.callPyObjectMaybePromising (https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.js:10:65316)
    at wrapper (https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.js:10:27006)
    at Cn.e.port1.onmessage (https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.asm.js:10:102154)

content = pyodide.http.open_url(url)
data = json.load(content)
else:
import urllib.request
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we used urllib originally because it was compatible with lite. Just wondering what the root cause is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's confusing but network requests through urllib don't work on Pyodide by default, where urllib3 works.

@@ -0,0 +1,30 @@
import { test, expect } from "@self/tootils";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it got deleted?

Copy link
Collaborator

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @whitphx !

@whitphx whitphx merged commit 5b86e2f into 5.0-dev Sep 13, 2024
21 checks passed
@whitphx whitphx deleted the lite-e2e-tests branch September 13, 2024 15:35
freddyaboulton pushed a commit that referenced this pull request Sep 16, 2024
* Add Lite E2E test to check a matplotlib problem which was fixed in #9312

* Restore js/app/test/image_remote_url.spec.ts, which was deleted in #8716

* Fix tootils import

* Format

* Fix processing_utils.resolve_with_google_dns to use the HTTPX client instead of urllib so it works on Lite

* add changeset

* add changeset

* Move js/app/test/image_remote_url.spec.ts -> js/spa/test/image_remote_url.spec.ts

* Use pyodide.http in resolve_with_google_dns on Lite

---------

Co-authored-by: gradio-pr-bot <[email protected]>
abidlabs added a commit that referenced this pull request Sep 19, 2024
* guides

* Add demo

* guide

* Add info about Powershell client (#9343)

* clients

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Remove lite/theme.css from the Git-managed file tree (#9335)

* Delete js/lite/src/theme.css from the Git managed file tree as it's dynamically generated

* Remove lite-related npm scripts from spa/package.json

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* 9227 chatinterface retry bug (#9316)

* first draft

* add code

* tip

* add changeset

* delete dead code

* Type check notebook

* consolidate like section with guide

* Add comments

* add value

* Lint

* lint

* guide

---------

Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Abubakar Abid <[email protected]>

* Move icons into `IconButtonWrapper` (#9261)

* * update icon buttons
* add image editor specific icon button

* tweak hover

* margin tweak

* add changeset

* improve gr.Video button UI

* radius tweak

* ensure even spacing

* fix typechecks

* add changeset

* revert irrelevant changes

* typefix

* fix image editor buttons

* fix download link icon

* disable undo if no change events dispatched in model3d and video

* use icons with iconbuttonwrapper

* add iconbuttonwrapper around gallery share btn

* Revert "add iconbuttonwrapper around gallery share btn"

This reverts commit 4605302.

* add changeset

* design fixes

* add changeset

* move status tracker progress to  bottom of component

* add changeset

* use iconbutton for like/dislike

* fix lint error

* fix type errors

* type errors

* fix test

* revert undo icon change

* btn spacing

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Added gradio-in-r (#9340)

* Added gradio-in-r

* add changeset

* section

* remove

* tweaks

* delete changeset

* R

* Updated using-gradio-in-other-programming-languages.md

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>

* Enhance Lite E2E tests and fix a networking problem on Lite (#9333)

* Add Lite E2E test to check a matplotlib problem which was fixed in #9312

* Restore js/app/test/image_remote_url.spec.ts, which was deleted in #8716

* Fix tootils import

* Format

* Fix processing_utils.resolve_with_google_dns to use the HTTPX client instead of urllib so it works on Lite

* add changeset

* add changeset

* Move js/app/test/image_remote_url.spec.ts -> js/spa/test/image_remote_url.spec.ts

* Use pyodide.http in resolve_with_google_dns on Lite

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Do not attach `content_disposition_type = "attachment"` headers for files explicitly allowed by developer (#9348)

* changes

* add changeset

* format

* fix type

* type

* add test

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Fix overflowing markdown in Chatbot (#9260)

* fix markdown overflowing table

* add changeset

* revert undo icon

* add changeset

* Revert "revert undo icon"

This reverts commit 855b012.

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* demo name

* Guide on Streaming Video for Object Detection (#9365)

* Add code

* notebooks

* Suggestions

* Add gif

* Small tweak to how thoughts are shown in `gr.Chatbot` (#9359)

* thiknk chat

* add changeset

* lint

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Use `container` param in `gr.Markdown` (#9356)

* * add param
* add story

* add changeset

* Use IconButton for copy btn

* fix test

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* small fixes (#9347)

* Updated Guide: Real Time Speech Recognition (#9349)

* Update real-time-speech-recognition.md

added necessary dependency

* Update run.py

updated code to handle cases with stereo microphone

* Update real-time-speech-recognition.md

improved english

* Update run.py

updated code for streaming

* Update run.py

* chunk space uploads (#9360)

* chunk space uploads

* Update upload_demo_to_space.py

Co-authored-by: Lucain <[email protected]>

* address comments + tweak CI

---------

Co-authored-by: Lucain <[email protected]>

* add find (#9368)

* New branch (#9369)

* add find

* fix syntax

* New branch (#9370)

* add find

* fix syntax

* add hidden files

* run format

* Testing CI  (#9379)

* remove unnecessary redirects

* add changeset

* fix

* formatting

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Fixes website build in 5.0-dev (#9382)

* changes

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Small tweaks to improve the DX for the "tuples"/"messages" argument in `gr.Chatbot` (#9358)

* change format

* format

* add changeset

* revert

* revert

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Update babylon.js to `v7` for `gr.Model3D` (#9377)

* update package.json

* add changeset

* add changeset

* update pnpm lock

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* Fix `gr.ImageEditor` toolbar cutoff (#9371)

* fix wrap alignment

* add changeset

---------

Co-authored-by: gradio-pr-bot <[email protected]>

* add lite upload (#9385)

* fix sha (#9386)

* Fix lite ci (#9387)

* fix sha

* fix name

* fix name

* Add code

* feedback

* link

* add changeset

* code

* check

* Update guides/04_additional-features/02_streaming-outputs.md

* Update guides/07_streaming/02_object-detection-from-webcam.md

---------

Co-authored-by: Abubakar Abid <[email protected]>
Co-authored-by: gradio-pr-bot <[email protected]>
Co-authored-by: Yuichiro Tachibana (Tsuchiya) <[email protected]>
Co-authored-by: Hannah <[email protected]>
Co-authored-by: Ifeanyi Idiaye <[email protected]>
Co-authored-by: Julien Chaumond <[email protected]>
Co-authored-by: Nikita Krasnytskyi <[email protected]>
Co-authored-by: pngwn <[email protected]>
Co-authored-by: Lucain <[email protected]>
Co-authored-by: Ali Abdalla <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants