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
Fixes .change()
in Video
, Audio
, Image
#4793
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4793-all-demos |
@@ -57,8 +57,6 @@ | |||
} else { | |||
value = null; | |||
} | |||
|
|||
dispatch("change"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed because we already dispatch change if the value changes in the subsequent lines
Chromatic build successful 🎉 |
.change()
in Video
and Audio
.change()
in Video
and Audio
and Image
.change()
in Video
and Audio
and Image
.change()
in Video
, Audio
, Image
, File
.change()
in Video
, Audio
, Image
, File
.change()
in Video
, Audio
, Image
🎉 The demo notebooks match the run.py files! 🎉 |
CHANGELOG.md
Outdated
* The `.change()` event is fixed in `Video`, `Image`, `Audio` by [@abidlabs](https://github.com/abidlabs) in [PR 4793](https://github.com/gradio-app/gradio/pull/4793) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a more descriptive changelog entry here explaining exactly what was fixed?
js/app/test/change_vs_input.spec.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should be unit tests as events can easily be tested without spinning up a browser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I'll look into it!
Hmmm CI is complaining about this error:
But I don't get this error when running locally. Edit: its no longer complaining about it. Not sure what could be responsible for the flake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me @abidlabs ! Gonna let @hannahblair @pngwn @dawoodkhan82 give the final approval.
@@ -41,6 +44,13 @@ | |||
let _value: null | FileData; | |||
$: _value = normalise_file(value, root, root_url); | |||
|
|||
$: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're trying to move away from JSON.stringify. I think the Label
component has the "preferred" way but gonna defer to @pngwn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good to know! Will take a look later
@@ -125,7 +125,7 @@ describe("Video", () => { | |||
root_url: null, | |||
streaming: false, | |||
pending: false, | |||
source: "microphone", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to change the source?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Video doesn't have a "microphone" source :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks for fixing this @abidlabs!
We had multiple separate issues:
change
event would get triggered twice when a file would be uploaded toVideo
orImage
Test with:
And:
or
change
event would not get triggered forAudio
if its value was changed programmaticallyTry:
This PR fixes these issues above
Closes: #4378, Closes: #4589
Adds unit tests and updates a demo (
change_vs_input
) that can be used to test the changes as well