Commit Graph

688 Commits

Author SHA1 Message Date
Freddy Boulton
96c17a7470
Add support for async generators (#3821)
* Add impl + unit test

* CHANGELOG

* Lint

* Type check

* Remove print

* Fix tests

* revert change

* Lint

* formatting

* Fix test

* Lint

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2023-05-08 23:21:47 -05:00
aliabid94
5ef0bfeefc
Allow textbox / number submits to trigger Interface submit (#4090)
* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-05-08 20:51:05 -05:00
Freddy Boulton
b66ecff671
[WIP] Language Agnostic Typing in /info route (#4039)
* First commit

* All serializers

* Remove output type

* Add route

* Format json

* Modify dropdown and slider choices

* Fix impl

* Lint

* Add tests

* Fix lint

* remove breakpoint

* Tests passing locally

* Format code

* Address comments

* Use union + fix tests

* handle multiple file case

* Add serializer to info payload

* lint

* Add to CHANGELOG

* grc version

* requirements

* fix test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-05-05 19:10:34 -05:00
Aarni Koskela
d1853625fd
More Ruff rules (#4038)
* Bump ruff to 0.0.264

* Enable Ruff Naming rules and fix most errors

* Move `clean_html` to utils (to fix an N lint error)

* Changelog

* Clean up possibly leaking file handles

* Enable and autofix Ruff SIM

* Fix remaining Ruff SIMs

* Enable and autofix Ruff UP issues

* Fix misordered import from #4048

* Fix bare except from #4048

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-05-04 21:54:23 -05:00
Freddy Boulton
71f1e654ab
Fix bug where functions with type hints caused errors (#4068)
* Fix + test

* CHANGELOG

* Update test/test_utils.py

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

* Update gradio/utils.py

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

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-05-04 21:38:41 -05:00
Dawood Khan
0f4a922444
Fixes issue with indentation in code field with streaming (#4043)
* indent fix

* fix

* changelog

* fix overflowing gutter and dark mode base color (#4051)

* Add ability to blocklist filepaths, ability to specify where gradio temp files are created (#4047)

* temporary file

* tests

* formatting

* rename

* added another test

* guide

* formatting

* changelog

* added custom gradio temp directory (#4053)

* added custom gradio temp directory

* Update 03_sharing-your-app.md

* rename test

* address review

* remove print

* Chatbot code syntax highlighting (#4048)

* first pass

* fixes

* more fixes

* remove breaks

* format

* version

* pr fixes

* changelog

* test fix

* background color

* format

* revert test fix

* changes

* changes

* test

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>

* fix

* fix test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2023-05-04 10:35:34 -05:00
Dawood Khan
c06901ed05
Chatbot code syntax highlighting (#4048)
* first pass

* fixes

* more fixes

* remove breaks

* format

* version

* pr fixes

* changelog

* test fix

* background color

* format

* revert test fix

* changes

* changes

* test

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2023-05-04 03:28:39 -05:00
Abubakar Abid
ff21ecbc25
Add ability to blocklist filepaths, ability to specify where gradio temp files are created (#4047)
* temporary file

* tests

* formatting

* rename

* added another test

* guide

* formatting

* changelog

* added custom gradio temp directory (#4053)

* added custom gradio temp directory

* Update 03_sharing-your-app.md

* rename test

* address review

* remove print
2023-05-03 17:30:38 -05:00
Aarni Koskela
4d629f04cc
Upgrade pyright to 1.1.305 (#4042) 2023-05-02 13:20:35 -05:00
Abubakar Abid
2be3ea1cc7
Sets matplotlib backend to agg before rendering math (#4029)
* matplotlib-agg

* fix

* context manager

* Update CHANGELOG.md

* update demos

* linting

* removed warning

* fix test

* fixes

* fix tests
2023-05-01 23:59:31 -05:00
1lint
f97b18ec9d
Allow decoding b64 string without header in processing utils (#4031)
* allow decoding b64 string without headers

* install gradio-client in edittable mode

* update GH actions

* add test for decoding headerless b64

* add test for decoding headerless b64 image

* some linting

* fix test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-05-01 18:24:54 -05:00
Abubakar Abid
f1ea4f79af
Allow state to be rendered multiple times (#4030)
* state render

* add test

* formatting

* changelog
2023-05-01 17:53:51 -05:00
Omar Sanseviero
398115b39a
Support new tasks with Hugging Face integration (#3887)
* Update pipelines.py

* Add pipelines that run models locally

* Fix typo

* Add new pipelines with API

* Add changelog

* changelog

* changes

* fix tests

* linting

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2023-05-01 12:18:58 -05:00
Lucain
b4206cd33a
Safer HuggingFaceDatasetSaver (and deprecate HuggingFaceDatasetJsonSaver) (#3973)
* Draft for a safer HuggingFaceDatasetSaver

* Rename (and replace) gr.SaferHuggingFaceDatasetSaver as gr.HuggingFaceDatasetSaver

* update changelog

* ruff

* doc

* tmp work

* merge 2 classes

* remove useless code

* adapt tests

* Update gradio/flagging.py

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

* Update CHANGELOG.md

* fix typing

* code formatting

* removed print from tests

* removing imports

* removing imports

* fix paths

* formatting

* wording

* formating

* fix tests

---------

Co-authored-by: testbot <lucainp@hf.co>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-05-01 11:59:41 -05:00
Aarni Koskela
12a97746ff
Ruff update + strictening (#3979)
* Update ruff to 0.0.263

* Get rid of bare except:s

* Fix two Ruff E731s by moving expand_{color,size} to the relevant classes

* Fix Ruff E731 and some variable shadowing in theme builder

* Fix remaining Ruff E731s

* Get rid of unused Ruff ignores

* Fix ruff B904 issues (raise from)

* Fix Ruff B007: loop-control variable not used

* Fix Ruff B011 (do not assert false)

* Remove unused args and kwargs from Progress.tqdm() (spotted via Ruff B026)

* Fix mutable argument default in CheckboxGroup

* Noqa ABC-related lint warnings for Interpretable

* Add missed assert in test_queueing (ruff B015)

* Enable ruff B

* Enable ruff C and fix issues

* Add changelog

* Add UP03[012] after #3984

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-28 17:59:42 -04:00
Aarni Koskela
d25226f704
Use f-strings where possible (#3984)
* Use f-strings where possible

Semi-automated using ikamensh/flynt

* Update gradio/utils.py

* Update gradio/interface.py

* formatting

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-27 16:09:50 -04:00
Freddy Boulton
7de41d94bb
After closing demo, reuse port if its specified (#3959)
* Reuse port when its specified after closing demo

* Add to changelog

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-25 10:07:35 -04:00
Micky Brunetti
5e9c3b0ac8
Fix HTTP code for file request (static, assets, file) (#3895)
* Fix HTTP code for file request (static, assets, file)

* Fix bugs related to utils.abspath for symlink and unresolvale path

* Requesting a directory from the file route now returns 403
2023-04-20 15:18:33 -04:00
January Desk
e0eea96766
Fix false positive warning in check_function_inputs_match (#3837)
* fix false positive warning of check_function_inputs_match

* apply linter

* Update CHANGELOG and add comments in test

* Lint

---------

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-19 15:44:28 -04:00
Hyoung-Kyu Song
d8bfa63a38
theme builder example doesn't work for 3.25.0 or later (#3869)
* theme builder example doesn't work for `3.25.0` or later
Fixes #3864

* update CHANGELOG.md

* Fix import order

* Lint

* added test

* add wheel

* wheel

* wheels

* pip

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-16 03:22:45 -07:00
aliabid94
1b4925712b
HighlightedImage component (#3836)
* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* rename

* changes

* changes

* changes

* changes

* Update CHANGELOG.md

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

* changes

* changes

* change

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-14 13:11:27 -07:00
Abubakar Abid
d3b7f73bcf
Update view api page to use Python client (#3765)
* Update view api page

* simplify

* update

* changes

* changes

* updated info

* formatting

* changes

* fixes

* save

* moved

* remove test input

* tweaks

* formatting

* add raw

* serialize

* fixes

* refactor

* fixes

* fixes

* Fetch api

* lower case

* view api

* fix tests

* format

* rough design

* readme

* api docs

* examples

* format

* formatting

* format

* version

* client changes

* formatting

* update client

* more example inputs

* api docs fixes

* remove notebook

* fix demo

* demo notebook

* styling on code snippet

* formatting

* fix audio, model3d

* format

* fix tests

* version

* cleanup

* format

* format

* format

* fixes

* version

* fix tests

* version

* format

* test

* format

* changelog

* changelog

---------

Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
2023-04-13 16:20:33 -07:00
Greysuki
54af6ae290
Adding subtitles to gr.Video (#3673)
* v2 version now accepts video and subtitle format inputs.

* remove debug log and some format issue

* Update CHANGELOG.md

* Upload components.py and regenerate demo

* fix components and add comment to function

* fix postprocess return format

* changelog

* demo change to gr.Interface type

* fix file_types

* fixes

* added video serializer

* clean up preprocess

* clean up postprocess

* formatting

* frontend

* fixed serialization

* dataclass

* fix serialize

* version

* fix tests

* version

* changelog

* typing

* version

* changelog

* version

* versin

* fix tests

* fix tests

* backend

* test

* changes

* relax test

* fix demo

* notebook

* changes

* fix

* changes

* Update gradio/components.py

* Update client/python/gradio_client/client.py

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2023-04-11 16:06:48 -07:00
aliabid94
379b6f662e
Get Image click coordinates from .select (#3786)
* changes

* changes

* fix demo notebook

* changes

* changes

* chagnes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-10 14:47:33 -07:00
space-nuko
303b4dc0b5
Improve error messages for when argument lists mismatch (#3519)
* Improve error messages for when argument lists mismatch

* Fix comment

* Update changelog

* Fix typeerror

* Fix single output case

* Add argument validation tests

* Lint

* Move changelog to correct section

* Fix typo

---------

Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
2023-04-07 13:22:42 -04:00
Abubakar Abid
5f8186218c
Document python client in gradio.app/docs (#3764)
* document py client

* more changes

* update docs

* changes

* fix tests

* formatting

* stash

* fix tests

* documentation

* more docs

* gradio client

* changes

* rework documentation

* add to docs

* modify dockerfile

* gradio client

* address feedback

* formatting

* gradio client version

* fix tests

* tweaks to website

---------

Co-authored-by: aliabd <ali.si3luwa@gmail.com>
2023-04-06 12:58:42 -07:00
space-nuko
ebfce0f784
Make gr.Code support lines, expand to fill entire element (#3651)
* Make `gr.Code` support `lines`, expand to fill entire element

* Update changelog

* Fix typeerrors

* Fix test

* fix interactive bug with update

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
Co-authored-by: pngwn <hello@pngwn.io>
2023-04-06 15:52:57 +01:00
Abubakar Abid
c0d70a7af5
Fix for default file name of recorded audio files (#3770)
* mic name

* changelog

* marked as flaky
2023-04-05 13:20:03 -07:00
Freddy Boulton
070b304e09
CI tweaks (#3752) 2023-04-04 14:02:20 -04:00
Aarni Koskela
ef3862e075
Switch linting to Ruff (#3710)
* Sort requirements.in

* Switch flake8 + isort to ruff

* Apply ruff import order fixes

* Fix ruff complaints in demo/

* Fix ruff complaints in test/

* Use `x is not y`, not `not x is y`

* Remove unused listdir from website generator

* Clean up duplicate dict keys

* Add changelog entry

* Clean up unused imports (except in gradio/__init__.py)

* add space

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-04-03 15:48:18 -07:00
Dan Sully
f868890cfe
Support IPv6 addresses for --server-name (#3695)
* Support IPv6 addresses for --server-name

* Update changelog now that I have a PR number.

---------

Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
2023-04-03 13:34:15 -04:00
aliabid94
759fb3b1f2
Fix chatbot newline issue (#3717)
* changes

* changes

* changes

* changelog

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-31 07:46:27 -05:00
aliabid94
09aedce77c
Theme builder (#3664)
* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* Update CHANGELOG.md

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

* Update gradio/themes/builder.py

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

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-30 11:20:34 -07:00
Freddy Boulton
f97b5c0c72
Add orig_name field to video outputs (#3700)
* Add orig_name to video

* Fix test

* CHANGELOG

* Lint
2023-03-29 20:34:04 -04:00
Abubakar Abid
2a8c82de01
Documentation-related fixes to the python client (#3663)
* docstring

* add documentation

* added more serialization classes

* format

* info

* is valid

* formatting

* changes

* fixups

* fix tests

* machine readable

* formatting

* client

* format

* tweaks on printing

* version

* linting

* fix tests

* update pypi requirements

* updates

* type ignore'

* fixes

* formatting
2023-03-29 15:00:20 -07:00
Abubakar Abid
dc37ddb739
fix sort script (#3696)
* fix sort script

* formatting

* script
2023-03-29 16:39:40 -04:00
space-nuko
df98c443f7
Fix default parameters value and gr.Progress in same function (#3671)
* Fix default parameters value and gr.Progress in same function

* Update changelog

* Fix tests

* Format

* Expand tests for other types of special function arguments

* Augment SelectData tests

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-28 19:37:38 -07:00
Abubakar Abid
fec48570c7
Load upstream theme (#3641)
* theme loading

* upstream theme

* version

* format themes

* fixes

* tests

* one more test

* fix test

* address review
2023-03-28 13:34:27 -07:00
Freddy Boulton
ceb5853480
Raise errror if event queued but queue is not enabled (#3640)
* Raise Error

* CHANGELOG

* Add progress tracking validate_queue_settings

* Update gradio/blocks.py

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

* Fix test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-27 18:01:02 -07:00
Abubakar Abid
b1f8d11e4e
Fix windows flake (#3650)
* fix windows flake

* format backend

---------

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2023-03-27 17:36:43 -07:00
space-nuko
212961ef6a
Support empty lists being used in gr.Dataframe (#3646)
* Support empty lists being used in `gr.Dataframe`

* Update changelog

* Add empty dataframe test

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-27 16:55:11 -07:00
space-nuko
e6ea19dee9
Add Windows CI (#3628)
* Add Windows CI

* Update changelog

* fix

* Skip one test on Windows

* Preserve virtualenv path

* Skip another test on Windows

* Make conditional flaky

* Requested changes

* consistent os

* cleanup

* fix test for windows

* remove unnecessary check

* lint

* lint

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-27 11:55:59 -07:00
Abubakar Abid
1c8d3cb05d
Simplify tests (#3608)
* simplify tests

* imports

* imports

* formatting

* removed cometml typing

* simplify

* changelog
2023-03-24 12:39:30 -07:00
Dawood Khan
811d26aab4
Use gradio-api-server for telemetry (#3488)
* analytics

* changelog

* remove interface analytics

* ip

* remove import

* format

* theme name

* theme analytics

* format

* changelog

* fixes

* format

* remove unused param

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-24 13:01:31 -04:00
Abubakar Abid
7a4e22b61a
Fixes Blocks exit issue (#3600)
* fix

* changelog

* blocks

* formatting
2023-03-24 09:48:32 -07:00
Abubakar Abid
6e6121a1ac
Sets up the Python gradio client (#3300)
* placeholder

* changelog

* added to readme

* client

* implement futures

* utils

* scripts

* lint

* reorg

* scripts

* serialization

* cleanup

* fns

* serialize

* cache

* callbacks

* updates

* formatting

* packaging

* requirements

* remove changelog

* client

* access token

* formatting

* deprecate

* format backend

* client replace

* updates

* moving from utils

* remove code duplication

* rm duplicates

* simplify

* galleryserializer

* serializable

* load serializers

* fixing errors

* errors

* typing

* tests

* changelog

* lint

* fix lint

* fixing files

* formatting

* type

* fix type checking

* changelog

* changelog

* Update client/python/gradio_client/client.py

Co-authored-by: Lucain <lucainp@gmail.com>

* formatting, tests

* formatting, tests

* gr.load

* refactoring

* refactoring'

* formatting

* formatting

* tests

* tests

* fix tests

* cleanup

* added tests

* adding scripts

* formatting

* address review comments

* readme

* serialize info

* remove from changelog

* version 0.0.2 released

* lint

* type fix

* check

* type issues

* hf_token

* update hf token

* telemetry

* docs, circle dependency

* hf token

* formatting

* updates

* sort

* script

* external

* docs

* formatting

* fixes

* scripts

* requirements

* fix tests

* context

* changes

* formatting

* fixes

* format fix

---------

Co-authored-by: Lucain <lucainp@gmail.com>
2023-03-23 15:33:44 -07:00
Freddy Boulton
926f3e21bf
Set theme name from load (#3595)
* Add name + test

* Add theme names

* CHANGELOG

* Delete theme in interface
2023-03-23 17:27:16 -04:00
Abubakar Abid
88afd684be
Makes some fixes related to TempFiles (#3523)
* temp file fixes

* changes

* fixing tests

* formatting

* fix

* fix chatbot processing

* tests

* get tests to pass

* fix code demo

* changelog

* fix multimodal
2023-03-21 09:37:24 -07:00
Abubakar Abid
c1b5d42cd2
Removes leading spaces from all lines of code uniformly in the gr.Code() component (#3556)
* code changes

* changelog
2023-03-20 22:07:46 -07:00
Freddy Boulton
6fbd25399e
Add theme sharing tutorial to guide (#3543)
* Add theme sharing guide

* Misc updates

* Use bullet points

* Fix typo in 3.7 requirements

* List all built-in themes in guide
2023-03-20 16:57:53 -04:00