Commit Graph

104 Commits

Author SHA1 Message Date
Freddy Boulton
18cc8a385c
Check file_types is a list (#3048)
* Add assertion for file_types

* Changelog

* Add logic to UploadButton

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-01-25 04:32:22 -05:00
Freddy Boulton
cab8d888dc
Fix validate url (#2957)
* Fix validate url

* Add unit test + fix impl

* Fix CHANGELOG

* Use head instead of get to check url

* Add head route for files

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-01-18 12:47:57 -05:00
Dawood Khan
1518f93c85
Fix issue where chatbot markdown support breaks older demos (removes <p> and /n) (#3006)
* fix

* chatbot test fix

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-01-17 22:46:42 +01:00
pngwn
d6fbc32ed1
Theme base 2 (#2840)
* add theme + theme atoms

* audio

* buttons

* chatbot

* forms

* start file

* complete file

* fixup workbench

* gallery

* highlighted text

* label

* json

* upload

* 3d model

* atoms

* chart

* md + html

* image

* plot + build

* table

* tabs

* tooltip

* upload

* tweaks

* tweaks + more tooling

* tweaks to padding/ lineheight

* app components _ start api docs

* format, more api docs

* finish api docs

* interpretation

* todos

* tweaks + cleanup

* tweaks + cleanup

* revert range tweaks

* fix notebooks

* fix test

* remove tw

* cleanup + login

* fix gitignore

* fix types

* run css script

* fix progress + tweaks

* update demos

* add css build to static check workflow

* tweak ci

* fix tests

* tweak markdown

* tweak chatbot + file

* fix tabs

* tweak tabs

* cleanup

* fix api docs

* fix example gallery

* add gradient to toast

* fix min height for interfaces

* revert tab changes

* update notebooks

* fix generating status animation

* fix weird table scrollbar that only appears on freddy's computer

* format

* fix dataset in gallery mode

* cleanup

* fix notebooks

* tweaks

* fix notebooks

* change

Co-authored-by: Ali Abid <aabid94@gmail.com>
2023-01-17 12:47:40 -08:00
Freddy Boulton
2bbec4b41e
Fix file serialization so that output is json serializable (#2999)
* Add comments

* CHANGELOG

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-01-17 11:29:27 -08:00
Dawood Khan
537fa11b78
Fixes file upload fails for files with zero size (#2923)
* fix file zero size erroe

* changelog

* fixes

* add a test

* formatting

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-01-15 20:38:28 -08:00
Dawood Khan
9fff1e0fe8
Enable multi-select on gradio.Dropdown (#2871)
* multiselect dropdown

* fixes

* more fixes

* changes

* changelog

* formatting

* format notebooks

* type fixes

* notebok fix

* remove console log

* notebook fix

* type fix

* Revert "format notebooks"

This reverts commit fb8762ecff.

* notebook fix

* bug fixes

* Update CHANGELOG.md

* Excluding untracked files from demo notebook check action (#2897)

* excluding untracked files from wget

* changelog

* fix setting default values

* typeability and arrow key support

* python types

* reformat

* another type check

* minor fixes + interactive false fix

* change remove token styling

* separate multiselect into separate file

* style fixes

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* some more style fixes

* small bug fix

* addressed pr comments

* fix active color highlighting

Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-01-04 19:13:46 -05:00
Abubakar Abid
09ebf00332
Timeseries hotfix (#2905)
* time series hotfix

* formatting

* formatting
2022-12-29 14:21:29 -05:00
Abubakar Abid
a3d0fcfab1
Added typing to more files (#2896)
* 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

* components.py t yping

* components.py

* formatting

* lint script

* merge

* merge

* lint

* pathlib

* lint

* events too

* lint script

* fixing tests

* lint
2022-12-29 12:33:12 -05:00
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
Abubakar Abid
88c9206159
Hotfix for tests related to #2721 (#2886)
* fixes

* formatting
2022-12-26 14:53:07 -05:00
Freddy Boulton
943b4ed77a
Wrap value in list for CheckBoxGroup. (#2866)
* Value error

* Add test

* Wrap value

* CHANGELOG

* Re-enable Example pagination on the front-end (#2861)

* Pass samples_per_page to examples

* Add to changelog

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

* Value error

* Add test

* Wrap value

* CHANGELOG

* Update docstrings

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-12-20 18:02:18 -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
Abubakar Abid
c126e62970
Add support for numpy array and other types to gr.Dataframe() initial value (#2804)
* bigquery draft

* updated guide

* orjson fix

* formatting

* changelog

* rm guide
2022-12-13 17:01:27 -06:00
Abubakar Abid
db48356832
Revert #2760 (#2799)
* changelog

* changelog
2022-12-12 13:10:39 -05:00
Alexandre Payot
c70f8fedd4
Merge highlighted text when neighbors (#2767)
* Merge highlighted text when neighbors

In the previous implementation dictionary inputs were not correctly
processed meaning: a None token was added on the empty string between
each entity. That None entry is removed letting neighbouring entities
be merged.

* Add changelog

* Add test

* Improve API compatibility and fix test

* Fix lint

* Strip out the empty entries on merge

* Test against the right reference

* fix changelog

* Apply suggestions from code review

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

* Remove additonal merge adjacent

* Fix lint

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-12-09 17:42:44 -08: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
Ajinkya K Mulay
76c4a553f5
Add backend validation for Slider, Radio, and CheckboxGroup (#2760)
* Add backend validation for form limitations [slider, radio, checkboxgroup]

Adds a preprocessing step for the slider, radio, and checkboxgroup components, as demonstrated in the issue "No backend validation for form limitations #1071."

* Update gradio/components.py

* Update gradio/components.py

* Update gradio/components.py

* fixes to logic

* updated tests

* formatting

* changelog fix

* revert test requirements

* delete artifact

* sanitizing docstrings

* comments

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-12-08 20:04:42 -08:00
Freddy Boulton
bed288a509
Add support for altair plots (#2741)
* Try clean install

* Resolve peer dependencies?

* frozen lockfile install

* Explicitly use version 16

* Add env

* Add altair demo

* Add unit test

* CHANGELOG

* Add image to changelog

* Add outbreak_forcast notebook

* Try again

* generate again

* Update ui/packages/plot/src/Plot.svelte

Co-authored-by: aliabid94 <aabid94@gmail.com>

* Fix title

Co-authored-by: aliabid94 <aabid94@gmail.com>
2022-12-02 14:53:42 -03:00
Abubakar Abid
588b0f7b2d
Show image thumbnails when example directory is provided (#2745)
* examples

* fixes

* formatting, changelog

* fix tests

* update documentation

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2022-12-01 13:41:54 -06:00
Freddy Boulton
dd90b37c9b
Update Label color from backend (#2736)
* Implement label improvements

* Fix tests + lint

* Update null case

* Types + changelog

* Add gif to changelog

* Changelog + implement for confidences

* Reduce dupe

* Change API - only use string - no function

* Update API in CHANGELOG

* Update comment

* misc fixes
2022-12-01 14:30:11 -05:00
Abubakar Abid
5c8e7887dc
Add Markdown support in chatbots (#2731)
* started working on this

* demo

* added markdown support

* notebook

* changelog

* tests

* chatbot

* formatting
2022-11-29 14:26:21 -06:00
Kashif Rasul
d79039beb1
Latex support (#2696)
* initial use of dollarmath plugin

* add frontend support

* chnages

* changes

* changes

* changes

* changes

* fix

* added latex to kinematics blocks

* changes

* Update CHANGELOG.md

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

* added example to changelog

* remove param

* doc fix

* fixes

* latex noteboox fix

* fix

* changes

Co-authored-by: Ali Abid <aabid94@gmail.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-11-29 11:26:17 -08:00
CoffeeVampir3
6c73e79c4e
Fixed a type bug where the validation was "binary" (#2727)
* Fixed a type bug where the validation was "binary"

In line 2113 the type was validated as either file or binary:
```python
        valid_types = ["file", "binary"]
        if type not in valid_types:
            raise ValueError(
                f"Invalid value for parameter `type`: {type}. Please choose from one of: {valid_types}"
            )
```

However line 2183 preprocess single file wanted either "file" or "bytes"
```python
            elif self.type == "bytes":
```

I have arbitrarily picked binary as the one to match, but now they are both consistent.

* added test, changelog, formatting

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-11-27 20:12:58 -06:00
Dawood Khan
b5f22671a2
Add Upload Button (#2591)
* add upload button

* upload button

* changelog

* Update CHANGELOG.md

* format

* update file component

* upload button fixes

* label

* remove fileupload changes

* remove file component changes

* restore lock file

* pnpm lock file

* Update CHANGELOG.md

* fixes

* fixes

* more fixes

* fix tests

* fixes

* lockfile

* fix test

* Update gradio/components.py

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

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-11-21 13:34:31 -05: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
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
Abubakar Abid
218fb9fa65
Allow gr.Templates to take in arguments (#2600)
* template customization

* changelog

* fixes

* import

* added test

* formatting

* explicit parameters

* updated changelog

* fix typing

* fix test
2022-11-04 09:08:17 -07:00
Abubakar Abid
43f5cf5f30
Load example from external Spaces (#2594)
* started

* loading examples

* saves

* fixes

* formatting

* iocomponent

* added support to other components

* fixed tests

* added video support

* added 1 test

* more changes

* reverted components.py

* remaining components

* formatting

* fixes

* fixes

* tests

* fixed ability to load multiple spaces
2022-11-03 12:35:56 -07:00
Freddy Boulton
f0d1cdf08f
Allow None in as_example for files (#2588)
* Fix file examples

* Changelog

* Fix changelog version name previous release
2022-11-01 17:36:38 -04:00
Freddy Boulton
dae17bb75a
Fix video mirroring issue (#2475)
* Fix video flip + test

* CHANGELOG

* Fix python 3.7 mock syntax

* Fix python 3.7 syntax

* Use .stem

* Lint
2022-10-18 11:07:03 -04:00
Abubakar Abid
e935f105e1
Improvements to gr.Dataset (#2437)
* Adding example components

* formatting

* formatting
2022-10-12 15:48:53 -05:00
Abubakar Abid
70eae89cef
Deprecates Carousel component (#2434)
* formatting

* carousel

* Update CHANGELOG.md
2022-10-12 11:37:58 -05:00
phi
a36dcb5975
Resolve Gallery base64 representation issues (#2265) 2022-10-07 06:08:30 +01:00
Abubakar Abid
6ee7efa86c
Fix HighlightedText component (#2221)
* entities

* tweak
2022-09-10 00:32:06 -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
9b4bf627f2
Add orig_name to serialized file repr (#2145) 2022-09-06 10:40:59 -04:00
Freddy Boulton
880c63e200
Better processing of example data prior to creating dataset component (#2128)
* WIP commit

* Add method to components

* Validate image filepath

* Remove unused imports

* Fix validation

* Only display name for model3D

* Remove image validation

* Don't use abstractmethod - add tests

* Remove unused import

* Remove breakpoint
2022-08-31 12:46:43 -07:00
Dawood Khan
4816e3fb12
Fix: Download button does not respect the filepath returned by the function (#2073)
* download fix

* tweaks

* formatting

* added orig filename

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-08-29 13:39:15 -07: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
adf52d2dad
Label component now accepts file paths to .json files (#2083)
* added label support for file paths

* formatting
2022-08-25 15:26:27 -07:00
Abubakar Abid
88e9c19c27
Cleaning up the way data is processed for components (#1967)
* remove preprocess_example

* removing methods

* added path support for images

* fixes

* video

* formatting

* fixing preprocess

* fixes

* removed from audio

* fixed file

* formatting

* serialization

* foramtting

* formatting

* removed save flag / restore flag

* formatting

* removed flagging

* removed

* load value

* fixing typing

* fixes, typing

* fixes

* file

* handling images

* formatting

* fixed serializing for flagging

* formatting

* json

* temp file

* removed processing

* changed processing

* fixed temp FINALLY

* flagging works

* fix examples test

* formatting

* async examples

* working on mix

* comment out failing test

* fixed interface problem

* fix kitchen sink deprecation warning

* gallery examples

* fixes

* fixes to serialization

* fixing label serializing

* fixed file serialization

* kitchen sink restored

* outbreak forecast updated

* formatting

* formatting and api mode

* fix 1 test :/

* fixing tests

* fixed components tests

* remvoed test files

* formatting

* fixed examples

* fixes

* formatting

* restored certain files

* added encryption

* fixed syntax mistake

* formatting

* fixed 1 test

* clean up interface

* formatting

* fixed route tests

* more fixes

* formatting

* formatting

* fixing pipeline

* format frontend

* format backend

* tweaks

* fix

* fix final test?

* merged

* Sanitize for CSV (#2017)

* sanitize for csv

* added sanitization logic

* fixed examples

* turn cache off

* fixed example caching with optional inputs

* fixed review problems

* fixed Interface.load

* updating the tests

* updating the tests

* fix

* fixed seriailizing

* testing

* rewrite run prediction

* formatting

* await

* fixes

* formatting

* finally fixed mix

* fixed tests

* formatting

* formatting

* deserialize fix

* formatting

* fixes

* fixes

* fix

* fix tests

* fixes

Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2022-08-23 08:31:04 -07:00
Freddy Boulton
75b51808e2
Convert video to playable format if ffmpeg installed (#2003)
* Add implementation + tests

* Add comments'

* Add warning

* Update docs

* Refactor logic

* 3.7 fix attempt

* Fix 3.7 take 2

* Return original video if the conversion fails

* Use ffmprobe + restrict scope of exception

* Fix for windows

* Fix tests
2022-08-16 13:21:13 -04:00
Ömer Faruk Özdemir
4e218fe00f
async-interface-fix (#1845)
* async-interface-fix

- support async in interface with workarounds
- make mix.Parallel async and concurrent

* async-interface-fix

- fix & tweaks

* fix interpretation

* async-interface-fix

- fix mix

* async-interface-fix

- fix tests
- tweaks

* async-interface-fix

- take TODO notes on interface related to refactoring

* async-interface-fix

- fix test_mix

* async-interface-fix

- test create_app

* fix series

* fix series

* reformat

* fix interface test

* - fix tests by moving them async

* - bypass the test

* - bypass the test

* - bypass the test

* - bypass the test without closing it

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2022-08-10 18:29:14 -04:00
Freddy Boulton
393c1f47d5
Fix invalid wav file error when converting from microphone to file (#1987)
* ;q
:wq

* Add demo

* Add unit test

* Fix test

* Slight refactor

* Lint

* Delete some recordings - import module not method
2022-08-09 16:40:31 -04:00
Freddy Boulton
d7c1a9eec4
Prevent Dataframe post-processing from changing dtypes (#1979)
* Fix datetime logic python

* Fix docstring

* Add demo

* Update test
2022-08-08 21:28:07 -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