Commit Graph

274 Commits

Author SHA1 Message Date
pngwn
11b88915d3
chore: update versions (#8291)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-16 00:23:53 +02:00
pngwn
929d216d49
always create a jwt when connecting to a space if a hf_token is present (#8296)
* fix param name

* format

* always create a jwt if a hf token is present

* add changeset

* add changeset

* remove throw

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-15 16:20:34 +02:00
renovate[bot]
7c81897076
chore(deps): update dependency esbuild to ^0.21.0 (#8229)
* chore(deps): update dependency esbuild to ^0.21.0

* add changeset

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-14 13:05:39 -07:00
pngwn
053316dd0f
chore: update versions (#8286)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-14 12:45:39 +00:00
pngwn
7d9d8eab50
use the correct query param to pass the jwt to the heartbeat event (#8285)
* fix param name

* format

* fix jwt queryparam

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-14 12:20:07 +00:00
pngwn
ca8864f514
chore: update versions (#8274)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-13 23:23:49 +00:00
Abubakar Abid
de52f0e5af
Reduce the analytics that are collected in Gradio (#8263)
* reduce analytics

* add changeset

* mark flaky

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
2024-05-13 23:10:08 +00:00
Abubakar Abid
a9e1a8ac56
Make exceptions in the Client more specific (#8264)
* more specific exceptions

* format

* add changeset

* fix

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-13 12:06:06 -07:00
Freddy Boulton
0bf3d1a992
Fix bug where client could not connect to apps that had self signed certificates (#8276)
* Add code

* add changeset

* Cancel request

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-13 18:22:39 +00:00
pngwn
fbf4edde7c
Client fixes (#8272)
* fix param name

* fix hidden state variable

* pass jwt to heartbeat event

* notebooks

* format

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-13 15:35:07 +01:00
pngwn
30463c5e15
chore: update versions (#8225)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-10 19:31:04 +01:00
Hannah
e09b4e8216
Add support for passing keyword args to data in JS client (#8197)
* allow passing kwargs to data param

* add changeset

* tweak

* update data usage in client/js readme

* more readme tweaks

* edit codesnippet

* add changeset

* check parameters exist

* add changeset

* test

* remove null check

* remove test

* use api_info

* unit tests

* type tweak

* test

* remove unused vars

* tweak

* import semiver

* tests tweak

* format code snippet

* feedback changes

* format

* typefix

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-10 19:46:28 +02:00
Freddy Boulton
c562a3d9a4
Cancel server progress from the python client (#8245)
* implementation + test

* add changeset

* WIP using events

* Use /cancel route

* Try bumping lite

* add changeset

* Fix stream closing issue

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-10 12:26:39 -04:00
pngwn
22df61a26a
Client node fix (#8252)
* fix client in node

* run all client tests in ci

* add changeset

* fix types

* add changeset

* format

* types

* add changeset

* format

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-09 12:06:28 +01:00
aliabid94
5436031f92
Render decorator 2 (#8110)
* changes

* add changeset

* changes

* changes

* changes

* changes

* changes

* changes

* changeas

* changes

* add changeset

* changes

* add changeset

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* add changeset

* changes

* cganges

* changes

* changes

* changes

* changes

* add changeset

* changes

* chagnes

* changes

* changes

* changes

* changes

* remove console log

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-05-06 08:36:07 -07:00
pngwn
be2b1e1261
chore: update versions (#8172) 2024-05-03 19:06:05 +01:00
Freddy Boulton
3a6f1a50b2
Only connect to heartbeat if needed (#8169)
* Add connect_heartbeat field

* fix types

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-03 13:36:02 -04:00
Hannah
91b5cd6132
remove redundant event source logic (#8211)
* remove redundant event source logic

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-03 17:22:55 +01:00
Hannah
b9afe93915
Rename eventSource_Factory and fetch_implementation (#8209)
* rename eventSource_factory -> stream_factory + rename event_source -> steam

* rename fetch_implementation -> fetch

* rename fetch to _fetch due to global.fetch conflict

* add changeset

* format

* format

* format

* format

* fix

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-03 15:24:19 +02:00
renovate[bot]
f5b710c919
chore(deps): update dependency eslint to v9 (#8121)
* chore(deps): update dependency eslint to v9

* update deps + fix things

* add changeset

* fix preview

* add changeset

* lockfile

* format

* add changeset

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-03 09:57:08 +01:00
Freddy Boulton
72039be93a
Support custom components in gr.load (#8200)
* Add code

* add changeset

* Update fuzzy-mirrors-scream.md

* Update fuzzy-mirrors-scream.md

* Fix tests

* Update .changeset/fuzzy-mirrors-scream.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Fix code

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-05-02 23:07:45 +00:00
Hannah
cf52ca6a51
Ensure connectivity to private HF spaces with SSE protocol (#8181)
* add msw setup and initialisation tests

* add changeset

* add eventsource polyfill for node and browser envs

* add changeset

* add changeset

* config tweak

* types

* update eventsource usage

* add changeset

* add walk_and_store_blobs improvements and add tests

* add changeset

* api_info tests

* add direct space URL link tests

* fix tests

* add view_api tests

* add post_message test

* tweak

* add spaces tests

* jwt and protocol tests

* add post_data tests

* test tweaks

* dynamically import eventsource

* revet eventsource imports

* add jwt param to sse requests

* add stream test

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-02 23:05:56 +02:00
Hannah
7aca673b38
Add eventsource polyfill for Node.js and browser environments (#8118)
* add msw setup and initialisation tests

* add changeset

* add eventsource polyfill for node and browser envs

* add changeset

* add changeset

* config tweak

* types

* update eventsource usage

* add changeset

* add walk_and_store_blobs improvements and add tests

* add changeset

* api_info tests

* add direct space URL link tests

* fix tests

* add view_api tests

* add post_message test

* tweak

* add spaces tests

* jwt and protocol tests

* add post_data tests

* test tweaks

* dynamically import eventsource

* revet eventsource imports

* add node test

* lockfile

* add client test in root pkg file

* lcokfile

* remove eventsource from js/app

* add changeset

* remove ts ignore

* move eventsource polyfill to eventsource factory

* add changeset

* tweak

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-02 22:49:55 +02:00
Abubakar Abid
39791eb186
Convert sse calls in client from async to sync (#8182)
* convert sse calls in client from async to sync

* add changeset

* more sync

* lint

* more sync

* fix threadpool

* fix timeouts

* reuse executor

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-05-01 21:48:49 -07:00
pngwn
6a218b4148
rework upload to be a class method + pass client into each component (#8179)
* rework upload to be a class method + pass client into each component

* add changeset

* Update client/js/src/utils/upload_files.ts

* fix storybook

* review comments

* Apply suggestions from code review

Co-authored-by: Hannah <hannahblair@users.noreply.github.com>

* format

* ts fix

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
2024-05-01 14:55:41 +00:00
Hannah
bed2f82e22
Implement JS Client tests (#8109)
* add msw setup and initialisation tests

* add changeset

* add walk_and_store_blobs improvements and add tests

* add changeset

* api_info tests

* add direct space URL link tests

* fix tests

* add view_api tests

* add post_message test

* tweak

* add spaces tests

* jwt and protocol tests

* add post_data tests

* test tweaks

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-30 18:50:38 +02:00
pngwn
dfd03f38bd
chore: update versions (#8069)
* chore: update versions

* Revert @gradio/code

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2024-04-25 23:08:27 +00:00
aliabid94
2e469a5f99
Using keys to preserve values between reloads (#8056)
* changes

* add changeset

* changes

* add changeset

* changes

* changes

* changes

* changes

* changes

* changes

* add changeset

* rev pn

* changes

* changes

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-04-25 11:25:53 -07:00
Ali Abdalla
17e83c958e
Docs Reorg and Intro Page (#8061)
* docs intro page and guides

* python library docs and js client

* reorg

* changes

* add better hovering

* fix broken version routing

* add redirects and remove duplicate pages

* fix build issues

* fix issues

* formatting

* add changeset

* add changeset

* Update js/_website/src/routes/[[version]]/docs/+page.svelte

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update js/_website/src/routes/[[version]]/docs/+page.svelte

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update js/_website/src/routes/[[version]]/docs/+page.svelte

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update js/_website/src/routes/[[version]]/docs/+page.svelte

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update js/_website/src/routes/[[version]]/docs/+page.svelte

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update js/_website/src/routes/[[version]]/docs/+page.svelte

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* styling changes

* formatting

* fix build

* rounded corners on buttons

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-04-23 13:33:45 -07:00
Abubakar Abid
cbdfbdfc97
upgrade ruff test dependency to ruff==0.4.1 (#8100)
* upgrade ruff==0.4.1

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-23 09:16:58 -07:00
pngwn
624f9b9477
make gradio dev tools a local dependency rather than bundling (#8066) 2024-04-19 18:41:40 -04:00
Hannah
450b8cc898
Refactor JS Client (#7646)
* initial setup

* fix hf token prefix

* warnings + error handling

* implement stream, predict and submit

* update blocks with new client

* add changeset

* temp comment

* add changeset

* add sse_v3 chages

* imrpove typing, reimplement websocket logic

* refactor zerogpu logic

* integrate fetch_implemenation

* wasm changes

* tweaks

* tscheck fixes

* type fixes

* test

* test import tweaks

* test

* package.json

* improve typing + config

* config tweak

* remove fetch-mock

* pnpm lock

* config

* remove module

* tweak

* tweak

* fix config

* test

* test

* lockfile

* fix types

* more config tweaks

* type fixes

* formatting

* fix typing

* formatting

* type fixes

* test

* lockfile

* revert comment

* package.json

* tweak

* formatting

* test

* revert ts removal

* remove comments + logic fixes

* type fix

* formatting

* test

* stream logic changes

* fix test

* revert comments

* fix streaming test

* stream tweak

* data typing

* fix wasm fetch

* client typing tweaks

* more fixes + typing improvements

* move functions

* event_source tweaks

* cleanup

* add hardware types and cleanup jwt

* improve api info typing

* add await client() backwards compatiblity

* rename create to connect and move duplicate logic

* Update `Client` usage examples (#8003)

* update client examples

* remove test data

* fix types

* remove types changes

* client -> Client.create

* Update client/js/README.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update client/js/README.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* update duplicate docs

* attempt to update cn docs

* format

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* type improvements and config error handling

* fix image editor issue

* Merge branch 'main' into refactor-client

* improve typing

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-04-19 23:36:13 +02:00
Freddy Boulton
2afca65419
Add max_file_size parameter to launch() that limits the size of files that can be uploaded in the Gradio app (#7909)
* File size limits

* Implementation

* add changeset

* Fix tests

* python client support

* lint

* fix test

* lint

* add changeset

* Set at the blocks level

* add changeset

* type check

* format

* lint

* lint

* Delete files as soon as they're encountered

* fix tests

* type hint 🙄

* Fix tests

* Fix below limit test

* add changeset

* Fix tests

* Add client file

* revert loop code

* Add to guides

* Pass in via gradio component

* add changeset

* Update loading status

* Make errors closeable

* add changeset

* Add code

* Lint

* Changelog highlight

* Fix i18n in storybook

* Address comments

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-19 15:38:53 -04:00
pngwn
ddc5d3866c
chore: update versions (#7992)
* chore: update versions

* changeset

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-18 18:09:10 +00:00
pngwn
dbb7373dde
ensure ImageEditor events work as expected (#7845)
* changes

* changes

* more fix

* more fix

* add changeset

* fix initial crop

* fix format

* fix format

* fix formats

* faster?

* race condition

* fixes + test

* fix type?

* notebooks

* fix type

* change demo

* add changeset

* fix type

* fix type

* fix type again

* fix type again again

* lint

* lint again

* fix test

* tests

* fix

* tests

* address comments

* fix notebooks

* fix tests

* fix stories

* fix webcam ui

* cleanup

* add changeset

* fix input event

* add format param + fix input event

* fix test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-04-15 20:16:07 +00:00
Yuichiro Tachibana (Tsuchiya)
79e0aa81c9
Fix heartbeat in the js client to be Lite compatible (#7974)
* Fix heartbeat in the js client to be Lite compatible

* add changeset

* add changeset

* Stop assigning the EventSource instance to a variable at heartbeat

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-10 23:13:12 +09:00
Charles
d28dab8224
[ZeroGPU] postMessage zerogpu-headers (#7877)
* Backup

* postMessage origin

* postMessage "zerogpu-headers" -> fetch headers

* Fix api_factory headers

* Oops

* ruff format

* Prettier

* Fix from_config

* Works with direct URL (without auth headers)

* Check that we're on Spaces

* Honor formatting
2024-04-09 12:44:15 -07:00
pngwn
b561a27816
chore: update versions (#7914) 2024-04-08 20:07:24 +01:00
aliabid94
9666854790
Fixes streaming event race condition (#7926)
* changes

* add changeset

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-04 12:39:44 -07:00
Abubakar Abid
2bae1cfbd4
Adds an "API Recorder" to the view API page, some internal methods have been made async (#7850)
* changes

* code recorder

* api docs

* add changeset

* changes

* change

* add changeset

* add changeset

* changes

* fixes

* format

* changes

* fix

* add changeset

* rename

* api recorder

* docs

* changes for pr

* fix

* async-ify

* add changeset

* fix typing

* fixes

* fix test/test_blocks

* fix more tests

* fix test

* add changeset

* fix more tests

* add async version

* make 2 separate functions

* format

* fix

* format

* fix tests

* move resource

* changes

* fix cache

* lite fixes

* make lazy cache async

* fix

* fix

* flaky

* replace null with None

* fixes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-04-03 14:28:06 -07:00
pngwn
bbdbd28453
chore: update versions (#7871)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-04-02 13:33:48 -04:00
Freddy Boulton
6a4bf7abe2
Delete user state when they close the tab. Add an unload event for the demo and a delete_callback on gr.State to let developers control how resources are cleaned up (#7829)
* Delete state

* add changeset

* Delete state

* WIP

* Add load event

* Working ttl

* unload e2e test

* Clean up

* add changeset

* Fix notebook

* add changeset

* Connect to heartbeat in python client

* 15 second heartbeat

* Demo for unload

* Add notebook

* add changeset

* Fix docs

* revert demo changes

* Add docstrings

* lint 🙄

* Edit

* handle shutdown issue

* state comments

* client test

* Fix:

* Fix e2e test

* 3.11 incompatibility

* delete after one hour

* lint + highlight

* Update .changeset/better-tires-shave.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update .changeset/better-tires-shave.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-04-01 18:31:56 -04:00
Freddy Boulton
946487cf8e
Cache view_api info in server and python client (#7888)
* Cache view_api info

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-29 13:17:42 -04:00
Abubakar Abid
75a2bf745d
Add guide on Client state and and fix default values of components (#7830)
* add guide and default values

* add changeset

* reset session

* fix

* add changeset

* fix tests'

* Update guides/08_gradio-clients-and-lite/01_getting-started-with-the-python-client.md

Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
2024-03-26 21:10:43 +00:00
pngwn
bf5110a26b
chore: update versions (#7771)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-25 12:35:44 -04:00
Abubakar Abid
b0a3ea951c
Small fix to client.view_api() in the case of default file values (#7800)
* fix view api page

* fix

* add changeset

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-22 17:27:03 -07:00
Yuichiro Tachibana (Tsuchiya)
d831040032
Remove Ruff and Uvicorn in Wasm env (#7744)
* Exclude `ruff` from the requirements list for Wasm env

* Exclude `uvicorn` from the requirements list for Wasm env and fix the related modules not to try to import it when not used

* add changeset

* Fix tests

* add changeset

* Apply formatter

* Remove a test case which became unnecessary in https://github.com/gradio-app/gradio/pull/5267, ref: https://github.com/gradio-app/gradio/pull/7744#issuecomment-2011332287

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-22 17:32:59 +09:00
Abubakar Abid
2efb05ed99
Adds support for kwargs and default arguments in the python client, and improves how parameter information is displayed in the "view API" page (#7732)
* changes

* changes

* add changeset

* improvements to api docs ui

* add changeset

* ux design work

* further styling

* feedback

* add changeset

* get parameter name

* fix code snippet

* construct args

* add changeset

* construct_args

* utils

* changes

* add catches

* fixes

* valid

* fix tests

* js lint

* add tests

* add changeset

* format

* client

* doc

* fixes

* changes

* api docs fixes

* fix .view_api()

* updating guide wip

* guide

* updated guides'

* fix

* guide fixes

* filepath

* address review

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-21 17:18:13 -07:00
pngwn
4da194fc77
chore: update versions (#7669)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-19 13:50:31 -07:00
aliabid94
84f81fec92
Closing stream from the backend (#7691)
* chganges

* add changeset

* changes

* changes

* changes

* changes

* maybe fix (#7715)

* maybe fix

* fix with demo

* changeset

* fix demo

* changeset

* changes

---------

Co-authored-by: Ali Abid <aliabid94@gmail.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-03-18 14:37:38 -07:00