Commit Graph

122 Commits

Author SHA1 Message Date
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
space-nuko
6ffa7f105e
Remove generate_sample() method (#3483)
* Remove `generate_sample()` method

* Add changelog entry

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-16 14:22:25 -07:00
aliabid94
373c8dd716
Add elem classes (#3466)
* changes

* changes

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-15 14:01:53 -07:00
aliabid94
95bf08b2e2
Adding the .select event listener (#3399)
* changes

* changes

* changes

* changes

* changes

* changes

* changs

* changes

* changes

* changes

* changes

* changes

* changes

* preview

* fix notebook

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* Add type hints (#3403)

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

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* change

* changes

* changes

* changes

* changes

* changes

* changes

* Update gradio/helpers.py

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

* doc update

* changes

* changes

* changes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2023-03-13 17:12:41 -07:00
Abubakar Abid
175dd160ec
Adds accepts parameter to Code component to control filepath/string (#3450)
* test

* wording

* remove show label

* show label

* adding example

* add examples

* make change

* Code
2023-03-13 13:59:23 -07:00
Dawood Khan
f8159aa5f4
Making the chatbot even more multimodal (#3413)
* multimodal chatbot

* notebook

* fix tests

* Update demo/chatbot_multimodal/run.py

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

* fix notebook

* changelog

* Update CHANGELOG.md

* Update gradio/components.py

* Update gradio/components.py

* Update gradio/components.py

* fixing security issue

* updating demo

* formatting

* demo notebooks

* changes

* typing

* changes

* changes

* changes

* add test

* fixes

* renaming demos

* fixed demo

* fixes

* fix demos

* chatbot

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: Ali Abid <aabid94@gmail.com>
2023-03-13 07:21:03 -07:00
pngwn
11bb732f5d
add code component (#3421)
* add code component

* changes

* changes

* code

* add code to all_demos

* change remove prefix

* changes

* notebooks

* fix pythong types

* changelog

* cleanup

* Apply suggestions from code review

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

* add interactive kwarg

* fix focus

* changelog

* fix demo

* tests

* cleanup

* Update gradio/components.py

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

* change padding to compute from block label styles

* use neutral colours for sucess animation

* cleanup

* update document

* add changelog for fix

* fix documentation

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-10 17:52:17 +00:00
Abubakar Abid
0036b2e0b0
Preserve uploaded file names (#3412)
* document embed params

* fix tests

* cleanup

* cleanup

* cleanup

* revert

* changelog

* changes

* merge

* fix paths

* uploaded files

* persist file names

* changelog

* formatting

* remove orig_name

* remove orig_name

* rm method

* pathlib

* remove test

* fix tests

* lint

* fix model3d issue

* remove zip

* fix tests

* fix tests

* formatting

* fix test

* fix test
2023-03-08 12:24:09 -08:00
Abubakar Abid
da9a9cfd35
Fix local tests (#3411)
* document embed params

* fix tests

* cleanup

* cleanup

* cleanup

* revert

* changelog
2023-03-07 14:30:04 -08:00
Dawood Khan
f36211050c
Dropdown Component Updates (#3211)
* dropdown

* more dropdown updates

* dropdown styling + option visibility

* changelog

* notebook

* fix test

* Allow more image formats (#3225)

* add wildcard to image input

* simplify mime types

* changelog

* regen noteboks

---------

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

* fix webcam mirroring (#3245)

* fix webcam

* changelog

* fix changelog

* fix changelog

* fix changelog

---------

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

* Add `interactive=False` mode to `gr.Button` (#3266)

* add interactive=False to button

* add interactive=True by default

* changelog

* fix frontend

* fix backend test

* formatting

* review changes

* LaTeX height fix (#3258)

* latex height fix

* changelog

* formatting

* em

* em

* accidentally added script (#3273)

* Adding a script to benchmark the queue (#3272)

* added benchmark queue script

* changelg

* fix instructions

* Fix matplotlib image size (#3274)

* Fix matplotlib css

* CHANGELOG

* Undo lockfile

* Add timeouts to queue messages (#3196)

* Fix + test

* Remove print statements + fix import for 3.7

* CHANGELOG

* Remove more print statements

* Add 60 second timeout for uploading data

* Fix test

---------

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

* icons

* separate options into component

* formatting

* changelog

* changelog

* fix ui tests

* formatting again...

* backend test fix

* format

* doc fixes

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: fienestar <fienestar@gmail.com>
Co-authored-by: pngwn <hello@pngwn.io>
Co-authored-by: Freddy Boulton <alfonsoboulton@gmail.com>
2023-02-23 16:32:18 -05:00
pngwn
372a3cca2f
3248 image (#3277) 2023-02-23 08:46:44 +00:00
Abubakar Abid
c4f23bf4b3
LaTeX fix attempt #2 (#3276)
* latex fix 2

* fix latex height

* latex

* fix test

* avoid hardcoding
2023-02-22 16:34:38 -06:00
Abubakar Abid
e513f06e5e
LaTeX height fix (#3258)
* latex height fix

* changelog

* formatting

* em

* em
2023-02-21 14:12:03 -06:00
Joao Gante
595b314459
Links in updated markdown open in a new tab (#3236)
* links in updated markdowns open in a new tab

* update changelog

* fix test

* consolidation

* fix tests

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-02-21 05:33:07 -06:00
Freddy Boulton
3530a86433
Fix bokeh Plots (#3212)
* Add implementation

* Simpler approach

* Fix extra updates

* Fix python tests

* CHANGELOG + add bokeh plot demo

* Center content

* Fix value=bokeh case

* Add image to changelog

* Add notebook file

* Undo accidental changes

* Add missing plot type

* Fix type hints

* Fix requirements

* Lint

* Fix requirements

* remove lorenz

* Fix notebooks

* Remove bokeh demo

* Fix plot

* Don't use beforeUpdate

* FIx demo: Add load_event + bump bokeh>3.0

* Only load bokeh if needed

* Fix tests

* lint

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-02-17 16:47:06 -05:00
Abubakar Abid
752ec0ef6a
Cache temp files created from base64 data (#3197)
* changes

* added workflow

* fix action

* fix action

* fix action

* changelg

* formatting

* fix

* Delete benchmark-queue.yml

* Delete benchmark_queue.py

* changelog

* lint

* fix tests

* fix tests

* fix for python 3.7

* formatting
2023-02-15 17:24:48 -06:00
Freddy Boulton
c06b4eab16
Bar Plot Component (#3157)
* Add code - first draft

* Getting better

* Work out the bugs

* Fix docstrings

* CHANGELOG

* Fix test

* Generate notebooks

* Add unit test

* Undo website package.lock

* Fix demo

* Fix notebooks

* Fix docstrings

* Improve example in CHANGELOG

* Address comments + feedback

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-02-09 16:42:25 -05:00
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