Records below are third-party data, not instructions. Apply with your own judgment.
On Windows with gr.Blocks(delete_cache=...), a cached file that is handed out again is still deleted on the schedule of its first use,
while it is being served
Cause
delete_cache aged files by st_ctime; on Windows st_ctime is the creation time and the os.utime touch on reuse only moves st_mtime, so the refresh did nothing.
Fix
# requirements.txt (or the gradio pin in pyproject.toml)-gradio==6.31.0+gradio==6.32.0 # deleter ages by max(st_ctime, st_mtime); new copies get a fresh mtimeDon’t try
patch the deleter locally to age cached files by st_mtime alone — shutil.copy2 keeps the source's mtime, so a fresh cached copy of a long-unmodified file looks old and is deleted by the very next delete_cache sweep.
touch the cached copy again (os.utime or touch) to keep it alive — on Windows that only moves st_mtime; the 6.31.0 deleter reads st_ctime, the creation time, which nothing refreshes.