Skip to content

examples, cache_examples fix#944

Closed
aliabid94 wants to merge 13 commits into
blocks-devfrom
examples_fixes
Closed

examples, cache_examples fix#944
aliabid94 wants to merge 13 commits into
blocks-devfrom
examples_fixes

Conversation

@aliabid94
Copy link
Copy Markdown
Contributor

Fix examples issues. Examples supported for:

  • Textbox
  • Number
  • Slider
  • Checkbox
  • CheckboxGroup
  • Radio
  • Dropdown
  • Image
  • Video
  • Audio
  • File
  • Dataframe

There were issues previously with file-type examples, e.g. Audio. Now these components use the URL instead of loading the data for examples, (much faster than converting the entire file to base64 and then sending to frontend).

Also cache_examples should work now. Functionality slightly different, now both input and output will automatically load on click if examples are cached.

Issues found in components not related to this PR:

  • Checkbox, CheckboxGroup, and Dataframe do not show updated values in the frontend when a function outputs to them.

Ali Abid added 2 commits April 6, 2022 17:21
@pngwn
Copy link
Copy Markdown
Member

pngwn commented Apr 7, 2022

#929 should fix checkbox and checkbox group not updating correctly. I'll be looking at Dataframe today or tomorrow.

Comment thread demo/image_classifier/run.py Outdated
Comment thread gradio/blocks.py Outdated
@pngwn
Copy link
Copy Markdown
Member

pngwn commented Apr 7, 2022

Is it necessary to pass the examples_dir around? Can't the API set the full path for the example source, it should know where things are? Likewise can we use the value.data property for the fullyqualified path instead of constructing it on the fly from the name? I'd like to treat data as consistently as possible regardless of the source and this would intropduce further inconsistencies.

The media component should be able to handle file paths as well as data uris as the source.

@aliabid94
Copy link
Copy Markdown
Contributor Author

aliabid94 commented Apr 7, 2022

Okay removed examples_dir and made FileData.data the ultimate source, but the concatenation to prefix root + "file/" does need to be done in the frontend because of cases where the frontend is not being served from the url as the backend (e.g. dev mode, embedded gradio instances), the frontend needs to create the full path to the resource.

EDIT: just saw you created normalise_file, will logic there

@aliabid94
Copy link
Copy Markdown
Contributor Author

added logic to normalise_file

Copy link
Copy Markdown
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

This looks great.

@omerXfaruq
Copy link
Copy Markdown
Contributor

omerXfaruq commented Apr 8, 2022

@aliabid94 can you rebase and resolve conflicts in this branch, as some big files entered to this branch with #955, but removed from other branches.

git rebase blocks-dev

These files create conflict:
image

Ali Abid added 2 commits April 8, 2022 10:21
@pngwn
Copy link
Copy Markdown
Member

pngwn commented Apr 8, 2022

I think that failure is flake, rerunning to check.

Edit: Yeah it was, all fine now.

@omerXfaruq
Copy link
Copy Markdown
Contributor

@aliabid94 did you rebase? Abubakar's commit "Added another demo and tweaks.." still lives in branch.

@omerXfaruq
Copy link
Copy Markdown
Contributor

If it is not resolved with a rebase I will edit this branch a little bit and remove that commit when I sit to the pc.

@abidlabs abidlabs removed their request for review April 8, 2022 18:40
@omerXfaruq
Copy link
Copy Markdown
Contributor

@aliabid94 if you have not rebased pls rebase like I mentioned. And if you have, please remove this commit from this branch. (Added another demo and tweaked some of the older ones). If you can't I can take a look in the next week as well.

@aliabid94 can you rebase and resolve conflicts in this branch, as some big files entered to this branch with #955, but removed from other branches.

git rebase blocks-dev

These files create conflict: image

@omerXfaruq omerXfaruq mentioned this pull request Apr 9, 2022
@abidlabs
Copy link
Copy Markdown
Member

So as discussed, let's close this @aliabid94 in favor of #971

@aliabid94 aliabid94 closed this Apr 11, 2022
@omerXfaruq omerXfaruq deleted the examples_fixes branch June 14, 2022 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants