Switch default order for sources for gr.Video so that upload is the default (#6994)

* switch default video source

* add changeset

* fix test

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
This commit is contained in:
Abubakar Abid 2024-01-10 12:02:53 -08:00 committed by GitHub
parent ccf317fc97
commit 623bc1aeb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"gradio": minor
---
feat:Switch default order for sources for `gr.Video` so that upload is the default

View File

@ -111,7 +111,7 @@ class Video(Component):
min_length: The minimum length of video (in seconds) that the user can pass into the prediction function. If None, there is no minimum length.
max_length: The maximum length of video (in seconds) that the user can pass into the prediction function. If None, there is no maximum length.
"""
valid_sources: list[Literal["upload", "webcam"]] = ["webcam", "upload"]
valid_sources: list[Literal["upload", "webcam"]] = ["upload", "webcam"]
if sources is None:
self.sources = valid_sources
elif isinstance(sources, str) and sources in valid_sources:

View File

@ -1464,7 +1464,7 @@ class TestVideo:
video_input = gr.Video(label="Upload Your Video")
assert video_input.get_config() == {
"autoplay": False,
"sources": ["webcam", "upload"],
"sources": ["upload", "webcam"],
"name": "video",
"show_share_button": False,
"show_label": True,