Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #5229 #5235

Merged
merged 5 commits into from Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/whole-buttons-drive.md
@@ -0,0 +1,5 @@
---
"gradio": patch
---

fix:fix #5229
2 changes: 2 additions & 0 deletions gradio/components/video.py
Expand Up @@ -239,6 +239,8 @@ def preprocess(
return output_file_name
elif not self.include_audio:
output_file_name = str(file_name.with_name(f"muted_{file_name.name}"))
if Path(output_file_name).exists():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a unit test @breengles ? Otherwise looks good!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @freddyaboulton! I added a simple test just like the one for the default behavior of gr.Video()

return output_file_name
if wasm_utils.IS_WASM:
raise wasm_utils.WasmUnsupportedError(
"include_audio=False is not supported in the Wasm mode."
Expand Down
5 changes: 5 additions & 0 deletions test/test_components.py
Expand Up @@ -1332,6 +1332,11 @@ def test_component_functions(self):
output2 = video_input.preprocess(x_video)
assert output1 == output2

video_input = gr.Video(include_audio=False)
output1 = video_input.preprocess(x_video)
output2 = video_input.preprocess(x_video)
assert output1 == output2

video_input = gr.Video(label="Upload Your Video")
assert video_input.get_config() == {
"autoplay": False,
Expand Down