Commit Graph

943 Commits

Author SHA1 Message Date
Shubham raj
6ebf0cedf5
Add support for diffuser pipelines in gr.Interface.from_pipeline(). (#7265)
* Add support for StableDiffusionPipeline

* Add support for Stable Diffusion pipelines in interface.from_pipeline(), import transformers and diffusers conditionally

* add changeset

* refactor: create helpers method to handle transformers and diffusers pipelines and refactored load from pipeline to use helper methods.

* Update test requirements.in, and generated requirements.txt after adding diffusers as dependency

* Fix reportPrivateImportUsage on diffusers pipelines

* Format code using ruff

* PIL is required library so moved it out of if block

* Add return statement to every if block and fix typo

* check module name of pipeline to decide how to handle that pipeline

* refactored if statements in pipeline_helper module

* exclude gradio from test requirements

* update tests requirements.txt using pip-compile --upgrade

* fix failing typechecks

* Add unit tests for one transformer and diffuser load from pipeline

* Refactor code to return dict from every if branch and replace all elifs

* Update requirements.txt using pip-compile

* Update requirements file

* Update test requirements file

* Add unit tests for handle transfomers and diffusers pipelines functions present in pipelines_helpers.py

* Add support for StableDiffusionPipeline

* Add support for Stable Diffusion pipelines in interface.from_pipeline(), import transformers and diffusers conditionally

* add changeset

* refactor: create helpers method to handle transformers and diffusers pipelines and refactored load from pipeline to use helper methods.

* Update test requirements.in, and generated requirements.txt after adding diffusers as dependency

* Fix reportPrivateImportUsage on diffusers pipelines

* Format code using ruff

* PIL is required library so moved it out of if block

* Add return statement to every if block and fix typo

* check module name of pipeline to decide how to handle that pipeline

* refactored if statements in pipeline_helper module

* exclude gradio from test requirements

* update tests requirements.txt using pip-compile --upgrade

* fix failing typechecks

* Add unit tests for one transformer and diffuser load from pipeline

* Refactor code to return dict from every if branch and replace all elifs

* Update requirements.txt using pip-compile

* Update requirements file

* Update test requirements file

* Add unit tests for handle transfomers and diffusers pipelines functions present in pipelines_helpers.py

* remove gradio from test requirements

* remove ap.py

* formatting and minor cleanup

* changes

* update version

* Version

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-03-08 11:53:38 -08:00
Abubakar Abid
cb3999eec7
Use x-forwarded-host header to determine the root url, and let users provide a full root_path to override the automatically determined root url (#7641)
* debug

* add changeset

* changes

* add changeset

* fix

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-08 10:15:11 -08:00
Freddy Boulton
0ae1e4486c
Control which files get moved to cache with gr.set_static_paths (#7618)
* First commit

* Add code

* undo demo changes

* add changeset

* Add documentation

* Rename to set_static_paths

* add changeset

* Fix docstring issue

* add changeset

* Address feedback

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-07 15:39:07 -05:00
Abubakar Abid
a22f3e062d
Fixing root path issue with subpath being repeated twice (#7624)
* fixing root path

* add changeset

* add changeset

* fix

* add changeset

* replace tests

* prints

* fix

* add test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-06 12:52:01 -08:00
Abubakar Abid
1a4b089e78
Refactor example_inputs(), separating its logic into two separate methods: example_payload() and example_value() (#7620)
* fix

* lint

* add changeset

* add changeset

* example

* checkbox

* fix, add test

* fixes

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-06 19:37:14 +00:00
Abubakar Abid
45316dafd4
fix flaky python tests (#7617)
* fix flaky python tests

* fix
2024-03-05 16:34:24 -08:00
Abubakar Abid
355ed666d9
Fix the root_url logic for streaming files (#7614)
* fix

* add changeset

* ignore

* add changeset

* changes

* changes

* linting

* demo

* changes

* blocks

* add changeset

* diff

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-05 15:21:45 -08:00
Abubakar Abid
4d5789e905
Allow mounted Gradio apps to work with external / arbitrary authentication providers (#7557)
* add parameter

* format

* add changeset

* docstrings

* changes

* changes

* docs

* mark flaky

* test

* docs

* docs

* push

* docs

* Update guides/01_getting-started/03_sharing-your-app.md

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

* fix typecheck

* error

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abdalla <ali.si3luwa@gmail.com>
2024-03-05 12:41:39 -08:00
Hannah
f26aba00a7
Prevent audio speeding up when trimming (#7599)
* fix trim region background colour and change showRedo -> show_redo

* tweak audio sampling logic

* add changeset

* add trim_region_color to py docs

* formatting

* use trim_region_color for trim border

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-05 20:10:10 +00:00
Abubakar Abid
d3384cb926
Prevent additional paths that can trigger credential leakage on Windows (#7598)
* format

* add changeset

* docstring

* fix

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-05 10:23:33 -08:00
aliabid94
375bfd28d2
Support simplified event api for event only updates (#7407)
* changes

* add changeset

* changes

* changes

* changes

* add changeset

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* chanegs

* 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>
2024-03-05 09:06:53 +00:00
Freddy Boulton
a57e34ef87
Add delete_cache parameter to gr.Blocks to delete files created by app on shutdown (#7447)
* Add code

* add changeset

* Add code

* trigger ci

* Add schedule

* Fix implementation

* Fix test

* Address comments

* add changeset

* handle examples

* Update guides/01_getting-started/03_sharing-your-app.md

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

* Fix code

* Fix code

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-03-05 01:51:02 +00:00
Abubakar Abid
1c22123268
Fixes method to resolve the root URLs (#7565)
* fix

* fix

* add changeset

* fix test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-03-04 07:52:49 -08:00
Abubakar Abid
98aa8082dd
Add /logout functionality for Gradio auth (#7547)
* logout

* changes

* add changeset

* documentation

* add test

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-27 14:53:24 -08:00
Abubakar Abid
f84720cd76
Prevent paths beginning with // or \\ (#7544)
* prevent smb paths on windows

* docstring

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-27 12:34:44 -08:00
Abubakar Abid
eda33b3763
Refactors get_fetchable_url_or_file() to remove it from the frontend (#7528)
* fetch

* add changeset

* add changeset

* simplify

* add changeset

* changes

* format

* add changeset

* changes

* format

* fixes

* lint

* fix components

* fixes

* typing

* format frontend

* path

* fixes

* fix stories

* lint

* lint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-26 13:01:00 -08:00
Abubakar Abid
84802ee6a4
Tighten CORS rules (#7503)
* tighten cors rules

* add changeset

* cors policy

* cors

* add changeset

* lint

* changes

* changes

* changes

* logging

* add null

* changes

* changes

* options

* options

* safe changes

* let browser enforce cors

* clean

* route utils

* fix

* fix test

* fix

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-22 11:54:51 -08:00
Abubakar Abid
ddd4d3e4d3
Reverts the revert that dropped changes from 2 PRs (#7495)
* Revert "Revert "changes""

This reverts commit 032435368d.

* patch
2024-02-20 18:36:10 -08:00
Ali Abid
032435368d Revert "changes"
This reverts commit 19dd2218dc, reversing
changes made to 6a93633054.
2024-02-20 16:21:27 -06:00
Aarni Koskela
17b6840887
Enable Ruff S101 (#7477)
* Update to Ruff 0.2.2

* Enable Ruff S101; don't use asserts in runtime code, or AssertionErrors for flow control
2024-02-19 13:29:20 -08:00
Abubakar Abid
b5bee49969
fix requirements (#7459) 2024-02-16 13:09:29 -08:00
Abubakar Abid
ba747adb87
Make fix in #7444 (Block /file= filepaths that could expose credentials on Windows) more general (#7453)
* test routes

* chagne

* add changeset

* add changeset

* type fixes

* fix typing issues

* typed dict

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-16 18:09:31 +00:00
Abubakar Abid
4faf8a7e86
Block /file= filepaths that could expose credentials on Windows (#7444)
* fix for windowss

* path

* add changeset

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-15 15:48:06 -08:00
Abubakar Abid
e329f1fd38
Prevent timing attacks to guess Gradio passwords (#7440)
* secure timing

* add changeset

* format

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-15 12:59:08 -08:00
Abubakar Abid
4ab399f40a
Allow config to include non-pickle-able values (#7415)
* fixes

* lint

* add changeset

* route utils

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-14 17:43:41 +00:00
Abubakar Abid
32b317f24e
Set root correctly for Gradio apps that are deployed behind reverse proxies (#7411)
* testing

* add changeset

* test

* backend

* fix

* add unit tests

* testing

* remove check

* add changeset

* trying something

* add changeset

* override

* add changeset

* fix

* fix

* clean

* lint

* route utils

* add changeset

* changes

* add changeset

* test

* revert testing

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-14 16:14:02 +00:00
aliabid94
65437ce832
Improve File Explorer performance (#7337)
* changes

* add changeset

* changes

* changes

* add changeset

* changes

* changes

* changes

* changes

* changes

* Update gradio/components/file_explorer.py

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

* Update gradio/components/file_explorer.py

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

* Update demo/file_explorer_component_events/run.py

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

* 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-02-13 16:51:47 -06:00
Abubakar Abid
fa8225d24d
Use updated component in postprocess() (#7402)
* component update

* add changeset

* add test

* lint

* refactor

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-12 22:05:31 +00:00
YuryYakhno
b5c74ffadb
Fix HTTPX package crash for some values of "article" parameter in the interface (#7389) 2024-02-12 13:44:08 -08:00
Ari Roffe
10951105b8
Upgrade from numpy's Legacy Random Generator to Random Generator (#7397)
* Update run.py

* replace all np.random.random with new generator code

* notebooks

---------

Co-authored-by: aroffe99 <ari.roffe@morningstar.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-02-12 10:20:46 -08:00
Freddy Boulton
a4a990ca05
Custom component 2e2 test (#7394)
* e2e test

* Add requirements
2024-02-12 10:06:22 -08:00
Freddy Boulton
6dfd40fc6b
Make set_documentation_group a no-op (#7377)
* push

* Use (

* add changeset

* add changeset

* fix

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-02-09 16:53:21 -08:00
Abubakar Abid
49d9c48537
[WIP] Refactor file normalization to be in the backend and remove it from the frontend of each component (#7183)
* processing

* add changeset

* changes

* add changeset

* add changeset

* changes

* changes

* clean

* changes

* add changeset

* add changeset

* root url

* refactor

* testing

* testing

* log

* logs

* fix

* format

* add changeset

* remove

* add root

* format

* apply to everything

* annoying fix

* fixes

* lint

* fixes

* fixes

* fixes

* fix tests

* fix js tests

* format

* fix python tests

* clean guides

* add changeset

* add changeset

* simplify

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: pngwn <hello@pngwn.io>
2024-02-07 14:39:33 -08:00
Abubakar Abid
aea14c4496
Refactor Inference API and rename it to Serverless Inference Endpoints (#7295)
* changes

* changes

* add changeset

* add changeset

* changes

* all pipelines

* format

* clean

* add examples

* fix audio classification

* format

* format

* fix all pipelines

* fixes

* fixes

* fix tabular

* add changeset

* added future

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-06 12:27:44 -08:00
Yuichiro Tachibana (Tsuchiya)
b25e95e164
Fix processing_utils.save_url_to_cache() to follow redirects when accessing the URL (#7322)
* Fix `processing_utils.save_url_to_cache()` to follow redirects when accessing the URL

* add changeset

* follow more redirects

* format

* add changeset

* add test

* validate urls

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-02-06 19:46:20 +00:00
cswamy
0d36ac05aa
Fixes issue with datatype setting in gr.Dataframe. Setting no longer dependent on col_count (#7286)
* fixed

* add changeset

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-02 09:34:16 -08:00
cswamy
daaaf9593e
Fixes issues related to gr.Dataframe receiving an empty dataframe (#7257)
* fixed

* tested and formatted

* add changeset

* add changeset

* fixes

* revert

* dataframe

* clean

---------

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-02-01 12:56:43 -08:00
Aarni Koskela
05d8a3c803
Update ruff to 0.1.13, enable more rules, fix issues (#7061)
* add changeset

* Update ruff to version 0.1.13

* Correct ruff target version

* Enable more Ruff rules and fix issues

* Enable ARG and fix issues

* Enable PL lints, fix issues

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-02-01 11:32:40 -08:00
aliabid94
68a54a7a31
Improve chatbot streaming performance with diffs (#7102)
* changes

* add changeset

* changes

* add changeset

* changes

* channges

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* changes

* canges

* changes

* changes

* changes

* Update free-moose-guess.md

* changes

---------

Co-authored-by: Ali Abid <aliabid@Alis-MacBook-Pro.local>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Ali Abid <aliabid94@gmail.com>
2024-01-31 10:39:46 -08:00
Abubakar Abid
3c8c4ac2db
Document the gr.ParamViewer component, and fix component preprocessing/postprocessing docstrings (#7116)
* add paramviewer to docs

* add changeset

* type fixing

* round to

* format

* revert to make test pass

* remove msg

* add changeset

* annotated image

* annotated image
push

* audio

* changes

* changes

* audio

* audio

* changes

* remove borders from code

* working

* fixes

* add changeset

* formatting

* build fix

* changes

* ls

* more components

* format

* some more

* more

* component

* plots

* buttons

* simple backend

* number

* more

* more

* simple templates

* format

* fixes

* backend

* fix tests

* fix test

* fixes

* formatting

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: aliabd <ali.si3luwa@gmail.com>
2024-01-31 09:36:21 -08:00
Abubakar Abid
60078df07f
Fix test requirements to be compatible with python 3.11 (#7225)
* stash pop

* lint fix

* add changeset

* changes

* add changeset

* exclude

* fix

* tokenizers, transformers fix

* changes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-01-30 13:30:27 -08:00
Hannah
e3217b4186
Amend audio waveform colour (#7207)
* change waveform color option types

* tweak waveform color setting

* snake case tweak

* add changeset

* tweak BE test

* tweak component BE test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-01-29 19:03:38 +01:00
Abubakar Abid
ccdaec4500
Add a simpleimage template for custom components (#7129)
* simpleimage template

* add changeset

* changes

* change

* changes

* update backend

* update frontend

* add changeset

* lint

* fix package

* add changeset

* remove warnings

* docstrings

* fix error

* fixes

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-01-26 17:29:29 -08:00
Freddy Boulton
c60ad4d34a
Use Gallery as input component (#7148)
* Gallery as input

* add changeset

* Add keep_captions parameter

* revert notebooks

* fix docstring typo

* use tuples

* remove keep_captions

* Update js/app/test/gallery_component_events.spec.ts

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

* more precise type hint

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: pngwn <hello@pngwn.io>
2024-01-25 18:51:59 -05:00
cswamy
6abad53677
Added polars dataframe support with demo (#7139)
* first commit

* minor update

* working polars

* fixed. demo added.

* add changeset

* dynamic import of polars

* Fix import logic

* add changeset

* Fix lint

* Add code

* Fix code

* Add code

* remove screenshot'

* delete

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: freddyaboulton <alfonsoboulton@gmail.com>
2024-01-25 12:56:54 -05:00
Freddy Boulton
b9616528ab
Remove kwargs from template components (#7142)
* Add test

* add changeset

* Fix type hints

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-01-24 20:35:51 -05:00
Hannah
bc2cdc1df9
Allow download button for interactive Audio and Video components (#7104)
* allow download button for interactive audio and video components

* add changeset

* document show_download_button in video.py

* ensure show_download_button is by default true for output and false for input components

* fix component test

* tweak default val

* val tweak

* fix test and add story

* pass editable param where needed

* fix another test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Dawood Khan <dawoodkhan82@gmail.com>
2024-01-23 11:33:59 +01:00
tsukumi
e8b2d8b2f8
Add sample rate config option to gr.Audio() (#6826)
* Fix a bug that caused the sample rate of audio to be 8000 Hz after trimming and a bug that caused volume amplification and clipping each time trimming was performed

* Fix format

* add changeset

* add sample_rate param to waveform_options

* add changeset

* set WaveformOptions defaults

* formatting

* formatting

* add changeset

* audio

* changes

* add changeset

* tweak sample rate logic + docstring

* Tweak docstring

* formatting

* linting

* type tweak

* remove redundant None check

* tweak waveform lifecycle

* fix test

---------

Co-authored-by: tsukumi <tsukumijima@users.noreply.github.com>
Co-authored-by: Hannah <hannahblair@users.noreply.github.com>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2024-01-22 10:56:48 -08:00
pngwn
3a944ed9f1
add autodocs (#7030)
* add autodocs

* remove unused code

* add changeset

* fix all of the things

* fix all of the things

* add changeset

* fix things

* tewak

* fix dep

* add ruff as dep with min version

* make output pretty + fix bugs

* tweaks

* fixes

* fix types maybe

* fix arg refs

* fix test

* fix md

* add error for version

* fix test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-01-18 20:47:01 +00:00
Freddy Boulton
9201f86450
Raise error in build step if custom component package is not installed (#7046)
* Check installation

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2024-01-18 10:44:32 -05:00