Tips for saving disk space with Gradio 💾
text
Tips for saving disk space with Gradio 💾
new_line
new_line
Try these out with gradio 4.22.0 ! Code snippet attached.
text
Try these out with gradio 4.22.0 ! Code snippet attached.
new_line
new_line
1. Set delete_cache. The delete_cache parameter will periodically delete files from gradio's cache that are older than a given age. Setting it will also delete all files created by that app when the app shuts down.  It is a tuple of two ints, (frequency, age) expressed in seconds. So delete_cache=(3600, 3600), will delete files older than an hour every hour.
text
1. Set delete_cache. The delete_cache parameter will periodically delete files from gradio's cache that are older than a given age. Setting it will also delete all files created by that app when the app shuts down.  It is a tuple of two ints, (frequency, age) expressed in seconds. So delete_cache=(3600, 3600), will delete files older than an hour every hour.
new_line
new_line
2. Use static files. Static files are not copied to the cache and are instead served directly to users of your app. This is useful for components displaying a lot of content that won't change, like a gallery with hundreds of images.
text
2. Use static files. Static files are not copied to the cache and are instead served directly to users of your app. This is useful for components displaying a lot of content that won't change, like a gallery with hundreds of images.
new_line
new_line
3. Set format="jpeg" for images and galleries. JPEGs take up less disk space than PNGs. This can also speed up the speed of your prediction function as they will be written to the cache faster.
text
3. Set format="jpeg" for images and galleries. JPEGs take up less disk space than PNGs. This can also speed up the speed of your prediction function as they will be written to the cache faster.
new_line
new_line
Tips for saving disk space with Gradio 💾

Try these out with gradio 4.22.0 ! Code snippet attached.

1. Set delete_cache. The delete_cache parameter will periodically delete files from gradio's cache that are older than a given age. Setting it will also delete all files created by that app when the app shuts down.  It is a tuple of two ints, (frequency, age) expressed in seconds. So delete_cache=(3600, 3600), will delete files older than an hour every hour.

2. Use static files. Static files are not copied to the cache and are instead served directly to users of your app. This is useful for components displaying a lot of content that won't change, like a gallery with hundreds of images.

3. Set format="jpeg" for images and galleries. JPEGs take up less disk space than PNGs. This can also speed up the speed of your prediction function as they will be written to the cache faster.


❤️
clem samusenps abidlabs radames avinash02 MaziyarPanahi victor clefourrier boapps
626a9bfa03e2e2796f24ca11
https://cdn-avatars.huggingface.co/v1/production/uploads/1654278567459-626a9bfa03e2e2796f24ca11.jpeg
Freddy Boulton
freddyaboulton
user
608b8bb39d7c9519b4adae19
https://cdn-avatars.huggingface.co/v1/production/uploads/1621947938344-noauth.png
Abubakar Abid
abidlabs
user
6064e095abd8d3692e3e2ed6
https://cdn-avatars.huggingface.co/v1/production/uploads/1648966381588-6064e095abd8d3692e3e2ed6.jpeg
Radamés Ajna
radames
user