Commit Graph

68 Commits

Author SHA1 Message Date
Abubakar Abid
de0c41c1c4
Enforcing typing in blocks.py and context.py (#2887)
* started pathlib

* blocks.py

* more changes

* fixes

* typing

* formatting

* typing

* renaming files

* changelog

* script

* changelog

* lint

* routes

* renamed

* state

* formatting

* state

* type check script

* remove strictness

* switched to pyright

* switched to pyright

* fixed flaky tests

* fixed test xray

* fixed load test

* fixed blocks tests

* formatting

* fixed components test

* uncomment tests

* fixed interpretation tests

* formatting

* last tests hopefully

* argh lint

* component

* fixed based on review

* refactor
2022-12-27 16:54:47 -05:00
Freddy Boulton
1765cf68ae
Make it so that default_enabled has no impact on queue behavior (#2876)
* Deprecate default_enabled + test

* CHANGELOG

* Remove docstring for deprecated param

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

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-12-21 16:11:20 -05:00
Freddy Boulton
96297c0bad
LinePlot (#2807)
* First draft

* Fix tests

* Fix pdb

* Figure out stroke dash + legend position

* Add legend position

* Add back gif

* Add demo + update demo

* Format notebooks

* Changelog

* More changelog

* Undo notebooks

* Reword

* Set lower bound for altair

* Modify docstrings

* Add LinePlot image to changelog
2022-12-20 11:13:51 -05:00
Abubakar Abid
4e7317036d
Adds an every parameter to every component (#2806)
* bigquery draft

* updated guide

* orjson fix

* formatting

* changelog

* attach every

* removed queue=False

* added test

* formatting

* adding event

* wip

* fix implementation

* remove prints

* formatting

* lint

* formatting

* reset guide

* changelog

* fix tests

* added test

* changelog

* renamed

* renamed

* lint
2022-12-15 16:07:44 -06:00
Abubakar Abid
20057aa946
Create fewer temp files and make them consistently-named (#2758)
* tmp files

* components

* changes

* temp_file_sets

* TempFileManager class

* added file manager

* internal functions

* tests

* formatting

* changes

* video tests

* added tests for File

* cheetah image

* formatting

* tests for upload button

* temp files

* formatting

* changelog

* fixed audio

* tmp files

* tmp files

* gallery

* deprecated type=file

* fixing tests

* patch os.path.exists

* fixed test_video_postprocess_converts_to_playable_format

* fixed tests

* changelog

* fix tests

* formatting

* added a download_if_needed

* formatting

* fixed download

* fixed gallery demo

* fix tests

* version

* fix for mac

* consolidate
2022-12-15 14:37:09 -06:00
Dawood Khan
714ab2cc09
Audio waveform (#2706)
* utils func

* changes

* changes

* changes

* notebook

* fix

* changes

* change

* changes

* changes

* notebook fix

* changes

* changes

* changes

* change

* fix

* revert backend changes,  gr.make_waveform

* notebook

* Update CHANGELOG.md

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

* format fix

* changes

* changes

* revert pnpm

* change

* change

* changes

* changes

* changes

Co-authored-by: Ali Abid <aabid94@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-12-15 12:35:22 -06:00
Freddy Boulton
3672e17256
Terminate generating events early if the session is closed (#2783)
* Return early if no awake events

* Add to changelog

* Add test

* Clarify when events are cancelled in the docs
2022-12-12 09:15:50 -05:00
Freddy Boulton
f60053d85f
gr.ScatterPlot component (#2764)
* Try clean install

* Resolve peer dependencies?

* CHANGELOG

* Add outbreak_forcast notebook

* generate again

* CHANGELOG

* Add image to changelog

* Color palette

* Fix colors + legend

* Tooltip

* Add axis titles

* Clean up code a bit + quant scales

* Add code

* Add size, shape + rename legend title

* Fix demo

* Add update + demo

* Handle darkmode better

* Try new font

* Use sans-serif

* Add caption

* Changelog + tests

* More tests

* Address comments

* Make caption fontsize smaller and enable interactivity

* Add docstrings + add height + width

* Use normal font weight

* Make last values keyword only

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

* Fix typo

* Accept value as fn

* reword changelog a bit

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-12-09 10:14:07 -05:00
Freddy Boulton
5b71ff7e6f
Update accordion from backend (#2690)
* Update accordion from backend

* Update changelog

* Add gif to changelog

* Use reactive values
2022-11-28 18:12:24 -05:00
Abubakar Abid
5e148c3752
Adding ability to access in Fastapi request object into your function (#2641)
* fastapi requests

* formatting

* implement

* fix

* formatting

* formatting

* changelog

* added demo

* remove print

* added to guide

* changes for queuing

* changes to gr.Request

* formatting

* formatting

* fixes

* lint

* fixed tests

* fix batching

* fixing tests

* cleanup

* lint

* added tests; fixed review

* improve docs
2022-11-19 00:52:06 -08:00
pngwn
4b57984ead
add password and email textbox types (#2653)
* add password and email textbox types

* changelog + fix tests

* formatting

* fix tests maybe

* fix tests

* add more tests

* whatever

* weird thing
2022-11-15 22:23:47 +01:00
Freddy Boulton
e6336d6882
Fix bug with gr.update and interactive=True (#2639)
* Fix update interactivity

* Lint

* CHANGELOG

* Fix

* Undo interactive=True

* Do not call update twice

* Add unit test

* Revert change

* Lint
2022-11-15 11:53:35 -05:00
Freddy Boulton
06353ca939
Pin fastapi test version to 0.87.0 (#2647)
* Pin fastapi test version

* trigger ci

* Upgrade to 0.87

* Update txt file
2022-11-14 14:31:03 -05:00
GLGDLY
b75b7b7475
Allow auth with using queue (#2611)
* Update queue.py

* Update queue.py

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update queue.py

* Update requirements.txt

websockets with version <=9.1 with raise TypeError: WebSocketCommonProtocol.__init__() got an unexpected keyword argument 'logger'

* fix issues after rebase

* feat Allow auth with using queue

* remove unused imports

* Update CHANGELOG.md

fix wrong position in changlog from the last pr #2428 also

* revert test_queue_enabled_for_fn that is changed due to unintended mistake

* remove comment

* update tests and merge main thread

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2022-11-09 04:24:51 -05:00
Abubakar Abid
010827e211
Refactoring to replace unittests with pytests (#2610)
* replace pytests with unittests

* formatting

* test blocks

* fixed test/blocks

* test components

* working on test components

* test components

* test components almost fixed

* removed unittest

* linting

* fix remaining tests

* lint

* formatting

* changelog
2022-11-08 01:37:55 +01:00
aliabid94
91abb3ae11
Allow gradio embeds in colab without share (#2455)
* changes

* change

* changes

* changes

* changes

* Update colab.html

* update version

* changes

* Update gradio/templates/colab.html

Co-authored-by: pngwn <hello@pngwn.io>

* changes

* changes

* changers

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* revert

* changes

* changes

* changes

* strings

* formatting

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: pngwn <hello@pngwn.io>
2022-11-03 15:51:30 -07:00
Freddy Boulton
a23eb53e3b
Run events every given number of seconds (#2512)
* WIP

* Fix implementation

* Fix units

* Rename

* Delete dead code

* This works

* Fix tests

* Final fix - still rough

* Reduce code duplication

* Fixing bugs + test

* Changelog

* Add gif to changelog

* Update demo and remove unused imports

* undo accidental diff

* Linting

* Add to guides

* Address comments

* formatting changelog

* Fix warnings
2022-10-28 17:53:06 -04:00
aliabid94
10552cb6fd
Allow user to send inputs as dictionary (#2550)
* change

* changes

* changes

* changes

* changes

* change

* changes

* changes

* changes

* changes

* changes

* format

* changes
2022-10-28 10:52:28 -07:00
Freddy Boulton
099e1e84ec
Properly dequeue cancelled events when multiple apps are rendered (#2540)
* Fix render + tests

* Add comment + changelog
2022-10-26 16:29:47 -04:00
Abubakar Abid
560b3f99c0
Fixes cancels to work with multiple blocks (#2530)
* fixes cancels to work with multiple blocks

* formatting and changelog

* formatting and test

* skip test in 3.7
2022-10-25 14:54:33 -07:00
Freddy Boulton
7f9223fdbe
Prevent api requests from skipping queue (#2493)
* Prevent request to rest api from skipping queue

* Release notes

* Make changes to show_api

* Update gradio/blocks.py

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

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-25 11:45:15 -04:00
Abubakar Abid
0e168c4dff
Batching (#2218)
* batch

* formatting

* added parameter

* batch

* added docstrings

* correct arguments

* docstring

* adapt process_api for batch

* backend

* __call__

* more regular tests

* formatting

* cleaning up blocks.py

* __call__ works

* api route works

* first attempt at queue

* fixing tests

* fix some tests

* formatting

* removed print

* merge

* queue works!

* removed batch timeout

* removed batch timeout

* updated documentation

* fixing tests

* fixing tests

* fixing queue tests

* fixing queue tests

* formatting

* fix blocks config

* fix tests

* update documentation

* updated tests

* blocks

* blocks

* blocks

* tests

* test fixes

* more tests

* faster

* foramtting

* test fixes

* dataclasses

* fix

* revert to fix test

* fix

* fix test

* formatting

* fix tests

* refactoring examples

* formatting

* changelog

* fix examples

* formatting

* fix tests

* formatting

* catch error

* formatting

* fix tests

* fix cancel with batch

* final tests and docs

* test routes

* formatting
2022-10-24 16:32:37 -07:00
Rahul Varma
a18099f683
Allow render() to return self (#2514)
* Update blocks.py

Updated render() function in Blocks to return self

* Update CHANGELOG.md

* formatting

* fix changelog

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-10-23 05:59:15 -07:00
Freddy Boulton
831ae1405f
Cancel events from other events (#2433)
* WIP

* Use async iteration

* Format + comment

* Very hacky WIP

* Fix synchronization

* Add comments + tidy up implementation

* Remove print

* Fix rebase

* Lint

* Disconnect queue when cancelled

* Add stop button for interface automaticallY

* Unit tests + interface fixes

* Skip some tests on 3.7

* Skip in 3.7

* Fix skip message

* Fix for python 3.7

* Add stop variant to button variant type union

* CHANGELOG

* Add demos/gifs to the changelog
2022-10-14 18:43:24 -04:00
Freddy Boulton
a03d0ebe7c
Prevent apps from hanging when running in reload mode and error occurs (#2394)
* Fix show_error in blocks

* dd to changelog + test
2022-10-04 16:10:02 -04:00
Abubakar Abid
c3306721a4
Adds ability to disable pre/post-processing for examples (#2383)
* fixing examples

* adding parameters

* postprocess

* examples

* added tests

* changelog

* Update CHANGELOG.md

* added docstrings

* Adds ability to provide a `gr.update()` dictionary even if `postprocess=False`  (#2385)

* docs

* fixes

* added docs, fixed test

* changelog

* fix suggestoins

* formatting

* fix tests

* fix tests
2022-10-04 12:51:20 -07:00
Abubakar Abid
e5a0a5e849
Raise error if Blocks has duplicate component with same IDs (#2359)
* duplicate error

* version

* version

* avoid rendering State twice

* changed error type
2022-09-28 13:29:25 -07:00
Freddy Boulton
9f7dd05b72
Start queue when gradio is a sub application (#2319)
* First stab at it

* Use util methos

* lint

* Test

* Fix formatting

* Try out setting predict endpoint from websocket request

* lint

* Fix bug

* Address comments - remove server and port

* Skip in 3.7

* Fix documentation

* Add default 🤦

* docs tweak

* Add back imports that were deleted by wrong linter version

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-09-23 16:01:44 -04:00
Abubakar Abid
c977ef1fa8
Supports gr.update() in example caching (#2309)
* support for update

* formatting

* testing

* fixes to tests

* fixes to tests

* fix tests

* fix review comments

* Update blocks.py
2022-09-21 11:53:06 -05:00
Freddy Boulton
f346118133
Show view api button even if there are no named api routes in the app (#2250)
* Show message when no named api routes

* Lint

* Change text slightly

* Add show_api to launch method + fix text

* Undo changes to demos

* Change url example
2022-09-15 11:11:31 -04:00
Freddy Boulton
422de63663
Fix postprocess when value is a dict with only one key (#2242)
* Unwrap + test

* Update tests + use resolve_singleton

* Undo test change
2022-09-14 12:06:32 -04:00
Abubakar Abid
2942e24aa3
Quick fix for partial functions (#2235)
* fix for partial

* added test

* fixed tests by adding self
2022-09-12 17:58:17 -07:00
Abubakar Abid
bf1510165d
Support for iterative outputs (#2189)
* Support for iterative outputs (#2162) (#2188)

* added generator demo

* fixed demo structure

* fixes

* fix failing tests due to refactor

* test components

* adding generators

* fixes

* iterative

* formatting

* add all

* added demo

* demo

* formatting

* fixed frontend

* 3.2.1b release

* removed test queue

* iterative

* formatting

* formatting

* Support for iterative outputs (#2149)

* added generator demo

* fixed demo structure

* fixes

* fix failing tests due to refactor

* test components

* adding generators

* fixes

* iterative

* formatting

* add all

* added demo

* demo

* formatting

* fixed frontend

* 3.2.1b release

* iterative

* formatting

* formatting

* reverted queue everywhere

* added queue to demos

* added fake diffusion with gif

* add to demos

* more complex counter

* fixes

* image gif

* fixes

* version

* merged

* added support for state

* formatting

* generating animation

* fix

* tests, iterator

* tests

* formatting

* tests for queuing

* version

* generating orange border animation

* testings

* added to documentation

Co-authored-by: Ali Abid <aabid94@gmail.com>
2022-09-08 07:35:31 -07:00
Freddy Boulton
6c1bfbb42c
Fix bugs with gr.update (#2157)
* Use void to reset to original state

* Cosmetic fixes to comments

* Use keyword

* Set default value to no value

* Fix test

* Make private

* Improve comment on _Keywords.NO_VALUE

Improve comment

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

* Use NO_VALUE in `test_blocks`

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

* Update test/test_blocks.py

Use NO_VALUE in tests

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

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-09-06 17:08:38 -04:00
Abubakar Abid
4d58ae79b3
Improvements to State (#2100)
* state

* state fix

* variable -> state

* fix

* added state tests

* formatting

* fix test

* formatting

* fix test

* added tests for bakcward compatibility

* formatting

* config fix

* additional doc

* doc fix

* formatting
2022-08-29 09:53:05 -07:00
Abubakar Abid
4a1321ce8a
Updated our analytics on creation of Blocks/Interface (#2082)
* added version to analytics

* formatting

* fix flake

* disabled analytics on anything that runs via ci/cd

* formatting
2022-08-25 13:23:28 -07:00
Freddy Boulton
e2dc87aa2b
Reset components to original state by setting value to None (#2044)
* Fix + test

* Fix test

* Rename demo file

* Delete unused demo

* Refactor into independent demos

* change (#2059)

* Remove chatbot

Co-authored-by: aliabid94 <aabid94@gmail.com>
2022-08-22 16:04:59 -04:00
Freddy Boulton
1fcff2d710
Allow Users to set random value on sliders on app load (#1935)
* Allow value=random for slider

* Commit all files

* Remove commented out breakpoint

* Remove unused imports

* Always bypass queue

* Lint

* Add randomize parameter

* Update docstring

* Add load_fn logic

* Add new random logic

* Add kitchen sink random

* Add random kitchen sink

* Fix tests + lint

* Add test all components accept load_fn

* Update docstring

* Address final comments

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-08-05 18:51:03 -04:00
Abubakar Abid
4149d00822
integrate() method moved to Blocks (#1776)
* integrating blocks

* formatting

* added tests

* tests

* formatting

* added integrate() to docs

* typing

* typing
2022-07-18 22:47:40 -07:00
Abubakar Abid
44e9a4d054
Fix assert_configs_are_equivalent_besides_ids() (#1700)
* fixed importlib

* reverted pkg resources

* fixed assert

* fixed xray config

* formatting

* ignored status tracker

* assert

* added copy

* formatting

* addressed feedback

* formatting

* unnecessary copy
2022-07-05 15:19:41 -07:00
Abubakar Abid
00a1894bf5
fixed load from spaces + added test (#1636)
* fixed load from spaces + added test

* formatting

* removed print
2022-07-01 20:21:54 -07:00
Edoardo Abati
db36d6880e
Changed share argument default in .launch method (#1449)
* changed default of share argument

* make share=False raise an Exception when localhost not reachable

* using self.share across the launch method

* reverted docstring to previous sentence

* added getter and setter for self.share

* added tests for setting Blocks.share

* fixed test

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-06-03 11:59:50 -07:00
aliabid94
d35e06abe7
Minor cosmetic changes (#1383)
* changes

* pass tests

* change to source sans

* formatting

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-05-26 14:33:28 -07:00
Abubakar Abid
cb2713e705
Getting Interface.load() working for 2.x and 3.x models and Spaces (#1361)
* version

* refactor for model and 2.x spaces

* fixing tests

* fixed tests

* getting there...

* formatting

* formatting

* fixes

* formatting

* external dependencies working

* formatting

* loading from 3.x

* changes

* wow finally it's working

* fixed formatting

* better error for spaces

* better error for spaces

* fixed 3.x bug

* formatting
2022-05-26 14:21:51 -07:00
Ömer Faruk Özdemir
e4b5d4c1b7
Reload mode on (#1278)
* reload-mode

-trys save

* reload-mode

- create minimal reloading example

* reload-mode

- create minimal reloading examples

* reload-mode

- amend

* reload-mode

- add user_mode

* reload-mode

- tweaks

* updated PyPi version to 3.0.3

* reloading

* reload

* formatting

* flexibility in naming

* added dev_mode flag to config

* added app id

* frontend changes

* changed debug level to warning to make less verbose

* Update ui/packages/app/src/main.ts

* fixed tests

* formatting

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2022-05-23 14:38:53 -07:00
Abubakar Abid
74703898c6
Model3d fix (#1342)
* fixing postprocessing

* fixed value

* formatting

* fixes

* model3d

* typing

* formatting

* formatting

* components

* fixed defaults

* fixed tests

* formatting

* removed unused import typing error

* fixed up model3d tests

* model3d

* formatting

* fix default value interactive bug

Co-authored-by: Dawood <dawoodkhan82@gmail.com>
2022-05-20 17:53:27 -07:00
Abubakar Abid
2adb841316
Jupyter extension for easier development with Blocks (#1321)
* jupyter magic

* formatting

* test fix

* formatting

* simplifications

* formatting
2022-05-18 15:14:53 -07:00
aliabid94
33ef309451
Allow Custom CSS (#1170)
* changes

* css changes

* updated PyPi version to 2.9b24

* Revert "updated PyPi version to 2.9b24"

This reverts commit 48f678f491.

* Revert "css changes"

This reverts commit d31cd525a4.

* Revert "changes"

This reverts commit fadcb12ffe.

* reverting

* reverting

* changes

* changs

* Revert "changs"

This reverts commit 49d815f6fe.

* Revert "changes"

This reverts commit 481d7c21c4.

* changes

* format

* changes

* format

* test fix

* test fix

* test fix

* fix tests

Co-authored-by: Ali Abid <aliabid94@gmail.com>
2022-05-11 21:40:41 -07:00
Ömer Faruk Özdemir
a88c017f87
async-function-support (#1190)
* async-function-support

- add async function support to Blocks

* async-function-support

- resolve conflicts

* async-function-support

- add error to Interface for async functions

* async-function-support

- add test

* async-function-support

- add test packages

* async-function-support

- add test packages
2022-05-11 23:10:50 +03:00
aliabid94
ce47c48ebc
Update component config (#1089)
* first commit

* changes

* restore defualt_value name

* changes

* rm value=

* rm value=

* rm value=

* changes

* changes

* changes

* rename default_val to value

* changes

* changes

* changes

* changes

* format

* changes

* changes

* format

* test fix

Co-authored-by: Ali Abid <aliabid94@gmail.com>
2022-05-10 17:11:43 -07:00