gradio icon indicating copy to clipboard operation
gradio copied to clipboard

Examples should be re-cached if input/output components have changed

Open abidlabs opened this issue 3 years ago • 2 comments

Right now, when self.cache_examples is True in the Interface class, the examples are not re-cached if the cached_example folder is present (to avoid recaching if the model takes a while to run).

A better way would be to delete the folder and recache if the inputs/outputs are changed even because the cached examples cannot correspond to the existing interface.

abidlabs avatar Jun 07 '22 22:06 abidlabs

Hi @abidlabs, I'd like to contribute to this issue, could you please point me to some resources to get started before I begin?

daspartho avatar Sep 07 '22 15:09 daspartho

Thanks @daspartho, absolutely!

Here is the logic for caching: https://github.com/gradio-app/gradio/blob/5360ea002ea79ca6016ff61842317f2227570015/gradio/examples.py#L235

You can see that if the CSV file exists, examples are not re-cached. Instead the old cache is used.

I think the approach that we should take is to check the headers of the CSV file. If they are still the same, then we can use the old cache. But if they have changed, we should delete the folder and re-cache.

abidlabs avatar Sep 07 '22 17:09 abidlabs

To be honest I'm inclined to close this issue as this has never actually been reported as a problem for users.

abidlabs avatar Mar 17 '23 18:03 abidlabs

Closing for now for reason mentioned above^

abidlabs avatar Sep 29 '23 17:09 abidlabs